4

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?

Note: versions:update-child-modules is not an option, since we can't define a specific target version

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588

1 Answers1

4

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.

Jakub Bochenski
  • 3,113
  • 4
  • 33
  • 61
Joe
  • 29,416
  • 12
  • 68
  • 88
  • Thanks. So it seems we are stuck with creating our own maven plugin – Sean Patrick Floyd May 15 '14 at 14:11
  • 1
    It looks like MVERSIONS-228 has been fixed ([r18605](https://fisheye.codehaus.org/changelog/mojo?cs=18605)), but a 2.2 release of the plugin hasn't been made yet. – Joe Dec 17 '14 at 09:31
  • Seems the issue just got dropped when codehaus was closing as it's nowhere to be found on the GH project page nor in Google – Jakub Bochenski Nov 02 '15 at 18:49
  • I believe the fix ([this commit](https://github.com/mojohaus/versions-maven-plugin/commit/c8aebf9456b646b9c9ccb415069a7fde6d9bbfae)) is included in 2.2, which has [now been released](https://github.com/mojohaus/versions-maven-plugin/releases/tag/versions-maven-plugin-2.2). – Joe Nov 03 '15 at 08:24