versions:2.17.0:set updates grandchilds with wrong version (original) (raw)

Hi,

I think there is a bug in versions:2.17.0:set when used in a maven reactor with different versions. We have

Grandparent: 
  <artifactId>Grandparent</artifactId>
  <version>1</version>
 
Parent:
   <parent>
     <artifactId>Grandparent</artifactId>
     <version>1</version>
  </parent>
  <artifactId>Parent</artifactId>
  <version>100-SNAPSHOT</version>
 
Child:
   <parent>
     <artifactId>Parent</artifactId>
     <version>100-SNAPSHOT</version>
  </parent>
  <artifactId>Child</artifactId>

Grandchild:
   <parent>
     <artifactId>Child</artifactId>
     <version>100-SNAPSHOT</version>
  </parent>
  <artifactId>Grandchild</artifactId>

If one calls
mvn versions:2.17.0:set -DnewVersion=2
Not only the version in grandparent and parent gets updated from 1 to 2 but also the version in Grandchild gets updated from 100-SNAPSHOT to 2. Also the log messages contains
[INFO] Processing change of com.company.test:grandparent:1 -> 2
[INFO] Processing com.company.test:grandparent
[INFO] Updating project com.company.test:grandparent
[INFO] from version 1 to 2
[INFO]
[INFO] Processing com.company.test:parent
[INFO] Updating parent com.company.test:grandparent
[INFO] from version 1 to 2
[INFO]
[INFO] Processing com.company.test:grandchild
[INFO] Updating parent com.company.test:child
[INFO] from version 100-SNAPSHOT to 2

If one calls
mvn versions:2.16.2:set -DnewVersion=2
instead, only grandparent and parent gets updated from 1 to 2.

Attached you find a minimal set to reproduce the error
testVersionsSet.zip