How to set versions in a non-standard maven reactor build?


How to set versions in a non-standard maven reactor build?

For reasons beyond my control, we have to use a maven project setup where the topmost pom.xml is not actually the parent pom. Now we would like to create a jenkins deployment pipeline, which of course would deploy a unique version of the entire reactor to our nexus repository.
Our setup is like this:
root (no parent pom)
 +---- parent  (company-wide parent pom is somewhere else)
 +---- module1 (parent pom is ../parent/pom.xml)
 +---- module2 (parent pom is ../parent/pom.xml)

Now we have to:

set the versions of root, parent, module1 and module2 to our unique build version
set the parent versions of module1 and module2 to the same build version
leave the version of the external parent pom intact

I see no parameters in the versions:set mojo that do this.
Calling mvn versions:set -DnewVersion=1.2.3 sets the version for the root pom only. The exact same call works perfectly in a traditional parent / child reactor build.
Is there any possible solution?
versions:update-child-modules is not an option, since we can't define a specific target version


Solution 1:

This has been discussed on the mailing list and reported (MVERSIONS-131) with the conclusion that this would best be handled through implementing support for wildcards:

mvn versions:set -DgroupId='*' -DartifactId='*' -DoldVersion='*' -DnewVersion=1.2-SNAPSHOT

This improvement is reported as MVERSIONS-228; it doesn’t appear to be implemented in the current (2.1) release of versions-maven-plugin.