Releasing a multi-module maven project with Git Releasing a multi-module maven project with Git git git

Releasing a multi-module maven project with Git


To see how to make this work, have a look at a working example, such as:

https://github.com/sonatype/sonatype-aether

However, this won't help if you like to release the individual pieces. In that case, you have to just copy the <scm> elements into all the poms.

This is an active topic of discussion on the maven dev list, but don't hold your breath for a solution from there; it's a big deal.


I found this question with a search on "git-push command failed". I have a similar configuration where I have a master-pom and then submodules that I release as their own maven packages.

To get it to work I had to tune the scm section of the pom.xml to something like the following. The connections specifically had to be tuned right to work. None of the github ones worked at all.

<scm>    <url>https://github.com/XXX/YYY</url>    <connection>scm:git:ssh://git@github.com/XXX/YYY.git</connection>    <developerConnection>scm:git:ssh://git@github.com/XXX/YYY.git</developerConnection></scm>

The XXX in the above example is your github username. You cannot use the :XXX format (git@github.com:XXX/...) because the value past the : is interpreted as being a port number instead. The YYY is obviously your repository name under the XXX account.

I just released all 3 of my submodules one-by-one using this pattern successfully.


I was trying to do a similar thing for a long time, and never found a good solution, so wrote my own release plugin for git. It only releases changed modules, you don't need any scm config, it tags based on the module names, and inter-component dependencies work.

Documentation: http://danielflower.github.io/multi-module-maven-release-plugin/index.html

Introduction blog: http://danielflower.github.io/2015/03/08/The-Multi-Module-Maven-Release-Plugin-for-Git.html