I’ve found quite a few hints about the maven-release-plugin
, multi-module, multi-project, parent POMs, etc. but they all don’t quite fit what I have:
I have several projects (the reduced case is two: project-common
and project-impl
) that are somewhat separate from each other, and developed in separate git repositories, but usually released together. For this purpose, project-common/pom.xml
contains:
<groupId>de.tarent.example</groupId>
<artifactId>project-common</artifactId>
<version>1.5.1.4-SNAPSHOT</version>
… and project-impl/pom.xml
contains:
<groupId>de.tarent.example</groupId>
<artifactId>project-impl</artifactId>
<version>1.5.1.4-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>de.tarent.example</groupId>
<artifactId>project-common</artifactId>
<version>${project.version}</version>
</dependency>
There is no parent POM.
The idea here is to generally use the version of project-common
for them all, but be able to occasionally do individual releases of only one project; in those cases, the dependency version would, of course, have to be manually changed, but that’s okay.
Now, we’re using Jenkins’ “Perform Maven Release” to create our releases. (Well, we wish to. The projects were until recently not releasable, so our developers built them by hand, complete with temporary files, unused files, local changes, LDAP passwords in XML configs, editor .swp
files, etc. – you can see why I was tasked to change this, despite not knowing Java™ or Maven or Jenkins. Or maybe, because of it.)
The release of project-common
goes without a hitch, but project-impl
fails at the very first phase, checking that there are no SNAPSHOT dependencies. Well duh. (There are none except the project-common
one.) Overriding the maven-release-plugin
to skip the SNAPSHOT check is impossible. Using a parent POM does not work here either, as these are completely separate repositories and, on occasion, released independently. So, how to do this while retaining the Jenkins and Maven Release comfort?
Continue on to: Answer your own question – share your knowledge, Q&A-style…