0

Lets say I have a multi-module project

Project A (pom.xml)
  - B (module pom.xml)
  - C (module pom.xml)

Now in A's pom.xml, under dependency management, i have the following dependency:

<dependency>
   <groupId>com.mycompany</groupId>
   <artifactId>C</artifactId>
   <version>1.0.0-SNAPSHOT</version>
<dependency>

In B's pom.xml I use the above dependency.

<dependency>
   <groupId>com.mycompany</groupId>
   <artifactId>C</artifactId>
<dependency>

Now lets say I run the following command on the root pom.xml (A's pom.xml)

mvn versions:set -DnewVersion=137.0.18 -DprocessDependencies=false

This command only sets the version for the parent and the submodules version (but doesn't update the dependency), which is as expected.

Now if I want to run the following command and process the dependency as well, like this:

mvn versions:set -DnewVersion=137.0.19 -DprocessDependencies=true

Now it does NOT process the dependency. Had if I ran the first command with processDependencies=true, it would have updated the dependency. I am unable to understand why running it the second time its not processing the dependencies? Sounds to me like a bug on versions plugin.

Ram Gaddam
  • 151
  • 1
  • 10
  • Which version of versions-maven-plugin do you use? – khmarbaise Jun 28 '17 at 07:06
  • @khmarbaise I am using 2.4 versions-maven-plugin and 3.2.2 maven. – Ram Gaddam Jun 28 '17 at 09:19
  • Do all modules including the parent have the same version? – khmarbaise Jun 28 '17 at 10:12
  • I think I got the issue. "mvn versions:set" works on the dependency only if the dependency shares the same version with the module. Can we enforce versions:set to set the version of the dependency independent of which version the dependency has ? – Ram Gaddam Jun 29 '17 at 05:05
  • The first thing is you have module interdependencies you should alway use `${project.version}` instead of literal versions. There are options like `-DupdateMatchingVersions=false` http://www.mojohaus.org/versions-maven-plugin/set-mojo.html – khmarbaise Jun 29 '17 at 09:11

0 Answers0