I’m trying to release a multi-module maven project that uses git as the SCM, and among the first problems I’ve encountered is the way in which the maven release plugin builds the release.properties scm.url. My parent POM looks something like this:
<packaging>pom</packaging>
<groupId>org.project</groupId>
<artifactId>project-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scm>
<connection>scm:git:git://github.com/username/project.git</connection>
<developerConnection>scm:git:git@github.com:username/project.git</developerConnection>
<url>http://github.com/username/project</url>
</scm>
<modules>
<module>api</module>
<module>spi</module>
</modules>
And the module POMs are straightforward:
<parent>
<groupId>org.project</groupId>
<artifactId>project-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>api</artifactId>
<version>0.2.2</version>
My goal is to be able to release individual modules since they each have different versions and I don’t want to increment all of the versions together each time I do a release.
When I change to the api directory and do a mvn release:clean release:prepare I’m met with the following output:
[INFO] Executing: cmd.exe /X /C "git push git@github.com:username/project.git/api master:master"
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to commit files
Provider message:
The git-push command failed.
Command output:
ERROR: Repository not found.
It looks like the maven release plugin creates the scm.url by appending the module name to the developerConnection, which ends up not being a valid repository at github. I’m not sure what the right way to set this up is. It might be the case that Maven + git + releasing an individual child module simply won’t work? Any input is appreciated.
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.