Reputation: 155
I am facing the need of changing the version of an aggregator maven project and the two modules it has, using versions:set
. One of the use cases does not work and I do not know whether I'm missing something or this use case in particular is not well-supported by the plugin. Child modules versions are not updated to 1.4.0 as they would match the versions of someother-parentartifact-1
and someother-parentartifact-2
. I have been unable to reproduce the problem using a version different to 1.4.0
so I guessed the plugin gets confused somehow.
Aggregator:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mygroupId</groupId>
<artifactId>my-aggregator</artifactId>
<version>1.4.0-RC1</version>
<packaging>pom</packaging>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<modules>
<module>module-1</module>
<module>module-2</module>
</modules>
</project>
Module 1:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mygroupId</groupId>
<artifactId>module-1</artifactId>
<version>1.4.0-RC1</version>
<packaging>jar</packaging>
<parent>
<groupId>com.myanothergroupId</groupId>
<artifactId>someother-parentartifact-1</artifactId>
<version>1.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>com.myanothergroupId</groupId>
<artifactId>some-lib</artifactId>
</dependency>
</dependencies>
</project>
Module 2:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mygroupId</groupId>
<artifactId>module-2</artifactId>
<version>1.4.0-RC1</version>
<packaging>jar</packaging>
<parent>
<groupId>com.myanothergroupId</groupId>
<artifactId>someother-parentartifact-2</artifactId>
<version>1.4.0</version>
<relativePath/><!-- lookup parent from repository -->
</parent>
<dependencies>
(bunch of dependencies)
</dependencies>
</project>
Some insights:
maven.deploy.skip
does not change the outcome.1.4.0
) matches the version of the parents of the child modules.mvn versions:set -DgenerateBackupPoms=false -DnewVersion=1.4.0 -DprocessAllModules
.update-child-modules
. No success.Some logs:
[INFO]
[INFO] ----------< com.mygroupId:my-aggregator >----------
[INFO] Building my-aggregator 1.4.0-RC1 [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.7:set (default-cli) @ my-aggregator ---
[INFO] Searching for local aggregator root...
[INFO] Local aggregation root: C:\somedirectory\my-aggregator
[INFO] Processing change of com.mygroupId:my-aggregator:1.4.0-RC1 -> 1.4.0
[INFO] Processing com.mygroupId:module-1
[INFO] Updating project com.mygroupId:module-1
[INFO] from version 1.4.0-RC1 to 1.4.0
[INFO] Updating project com.mygroupId:module-1
[INFO] from version 1.4.0 to 1.4.0-RC1
[INFO]
[INFO] Processing com.mygroupId:module-2
[INFO] Updating project com.mygroupId:module-2
[INFO] from version 1.4.0-RC1 to 1.4.0
[INFO] Updating project com.mygroupId:module-2
[INFO] from version 1.4.0 to 1.4.0-RC1
[INFO]
[INFO] Processing com.mygroupId:my-aggregator
[INFO] Updating project com.mygroupId:my-aggregator
[INFO] from version 1.4.0-RC1 to 1.4.0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for my-aggregator 1.4.0-RC1:
[INFO]
[INFO] module-1 .................................... SKIPPED
[INFO] module-2 .................................. SKIPPED
[INFO] my-aggregator ......................................... SUCCESS [ 3.445 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.637 s
[INFO] Finished at: 2019-07-04T17:02:37+02:00
[INFO] ------------------------------------------------------------------------
Thanks in advance for your help.
Upvotes: 0
Views: 2180
Reputation: 155
I've made this work with mvn versions:set -DgenerateBackupPoms=false -DnewVersion=1.4.0 -DoldVersion=* -DgroupId=* -DartifactId=*
Upvotes: 4