2

I've got a multi-module maven project with a build/aggregate pom. In my project, I have a common parent pom which has a version number set, and all child modules inherit the parent version (ie: there is no version information in any of the child poms). However, the build pom has it's own version number and does not inherit the parent pom.

Project
|- InfoJava
|- InfoWebApp
|- InfoMavenCommon (parent pom)
|- InfoBuild (build pom - may have a unique version number and does not inherit InfoMavenCommon)
|- InfoEar

I'm trying to update the project's build version (ie: the parent version). By updating the parent version, I also need to update all the child module's reference to the parent. Ex:

<parent>
    <groupId>com.webinfo</groupId>
    <artifactId>InfoMavenCommon</artifactId>
    <version>3.9.1</version>
    <relativePath>../InfoMavenCommon</relativePath>
</parent>

However, I'm not sure how to use the versions plugin properly. The only way I have found this to work is to run the following:

Project/InfoMavenCommon$ mvn versions:set -DnewVersion=3.9.0

which updates the parent pom version, but doesn't recurse into the child modules, and then

Project/InfoMavenBuild$ mvn -N versions:update-child-modules

This does not seem "right" - two steps and not really using the update-child-modules the way it is supposed to be.

From which module should I be calling the versions:set goal? Is there a one-step solution to have the parent and all the children automatically update their versions?

Eric B.
  • 23,425
  • 50
  • 169
  • 316

0 Answers0