Maven Release plugin for beginners

What is Maven Release Plugin

This plugin is used to release a project with Maven, saving a lot of repetitive, manual work. Releasing a project is made in two steps: prepare and perform.

What we going to do

In this blog, we are going to discuss basic step Maven Release Plugin.

  1. We are going to configure pom.xml for Maven Release Plugin
  2. We are going to configure setting.xml in order to give Github authentication
  3. Finally, we are going to make tag release.

All the xml file and sample project will provide at the end of the blog. Here I do more of a practical guide than explaining. You can get to know more about Maven Release Plugin in their documentation. Here it is

Let’s get our hands dirty.

Configure pom.xml for Maven Release Plugin

In Order to do that we need to complete 3 things.

  1. Add Maven Release Plugin to pom.xml
  2. Add developerConnection using scm section.
  3. Add GitHub authentication using server.xml

Let’s Add Maven Release Plugin to pom.xml

First you need to add Maven Release Plugin as a dependency into pom.xml. Like below


Then you need to include its configurations into <build> tag in like below



Now you have completed the first Step. Now let’s do the second one

Add developerConnection using scm section.

developerConnection is one of must do things to work Maven Release plugin. The developerConnection contains the URL of the Source Control Management system pointing to the folder containing this pom.xml This URL is prefixed with scm:[scm-provider] so the plugin can pick the right implementation for committing and tagging. The Maven SCM-page contains an overview all the supported SCMs, per SCM you can see how the URL should look like.


Remember that

<developerConnection>scm:git:“This is url you need to clone your project”</developerConnection>

you can find it in your GitHub project. Like Below selected.

Now we need to complete our last step to final this.

Add GitHub authentication using server.xml

For that, you need to access setting.xml file which resides in your maven folder. First, you need to find out where is Maven folder. If you don’t know where exactly the location, you need to run below command in your terminal (in Ubuntu)

mvn -v

This command will return a result like below.

Now you know the location of maven you need to access setting.xml file which resides in below location.

maven -> conf -> settings.xml

But be aware if your settings xml file reside in /usr/share/maven then you need superuser powers to edit it. it can be done using command

sudo gedit /usr/share/maven/conf/settings.xml

Then you need to insert your Github credentials like below format into settings.xml under <servers> tag.

<username>Github username</username>
<password>Github password</password>
After that save the file and close it. Now you need add those Github credentials to pom.xml of the project.


Remember that <> is the <id> you gave in settings.xml <server>

if you followed me up correctly now your project is ready for tag release just run

mvn release:clean release:prepare

and check on releases tab in your Github project like this if tag went correctly or not.

If there is a tag release under the tag you gave, Congratulations.

  1. pom.xml
  2. Settings.xml
  3. Source code for sample project

About Author:

Leave A Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.