Releasing a multi-module maven project with Git

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://[email protected]/XXX/YYY.git</connection>
    <developerConnection>scm:git:ssh://[email protected]/XXX/YYY.git</developerConnection>
</scm>

The XXX in the above example is your github username. You cannot use the :XXX format ([email protected]: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.


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.


For anyone that comes to this question in search of a good solution as I did, what I found that works for me is the following:

http://blog.avisi.nl/2012/02/15/maven-release-plugin-setup-guide-for-git/

You still 'tag' off the entire trunk because that's how git works but it allows to you only build/version/deploy the submodule that you want to.


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

Tags:

Git

Maven

Github