Maven‎ > ‎

Maven 3 Release

Using the release plugin under Maven 3 can sometimes cause some problems.

Firstly, a distribution management element must be defined, telling Maven where to deploy the release.
Such an element could look like the following:



Out of the box Maven 3 only supports the file, http and https protocols, but these protocols does not always meet the requirements for deploying.
In this case scpexe is chosen for deployment. It seems that Maven uses the scpexe protocol when utilizing an external scp client and the scp protocol when using an internal.



The above <extension> element allows Maven to run an external ssh application. Besides adding this element to the pom, the implementing jar must be added to ${MAVEN_HOME}/lib.
The jar can be found at
You can see the Maven installation directory with which mvn.

You can attach an scm to the release, which will update the remote repository with the new information and add a tag.
In this case Git with a remote repository at



This will release the current version incrementing to the next SNAPSHOT, pushing the changes and adding a version tag to GitHub and deploying the artifact to the Maven repository.
Note that a valid GitHub certificate is required and a valid certificate to the Maven repository is also required. Plus the user needs write access to the repository directory. This could
be done creating a group, maven, and letting this group have write access. The user could then be added to that particular group.

If something goes wrong you can rollback like the following:
  • mvn release:rollback - rolls back the changes done in the pom and commits it to the scm
  • mvn release:clean - cleans the workspace
  • git tag - lists the tags, pick the one Maven made,
  • git tag -d <tag> - removes the tag from the local index
  • git push <remote> :<tag> - removes the tag from the remote, typically origin
  • git reset --hard HEAD^ - rolls back the repository, one commit at the time. Roll back to before Maven committed anything, typically two.
  • git push -f - push the rollback to the remote