I did much research on this but could not resolve it so far.
I've following structure,
root folder
parent/pom.xml (parent pom)
artifact1/pom.xml
artifact2/pom.xml
pom.xml (aggregator pom)
root/pom.xml
------------
<parent>
<groupId>releasetest2</groupId>
<artifactId>root</artifactId>
<version>1.0.4</version>
<relativePath>parent</relativePath>
</parent>
<artifactId>aggregator</artifactId>
<packaging>pom</packaging>
artifact1/pom.xml
-----------------
<parent>
<groupId>releasetest2</groupId>
<artifactId>root</artifactId>
<version>1.0.4</version>
<relativePath>../parent</relativePath>
</parent>
<groupId>releasetest</groupId>
<artifactId>artifact1</artifactId>
<packaging>jar</packaging>
artifact2/pom.xml
-----------------
<parent>
<groupId>releasetest2</groupId>
<artifactId>root</artifactId>
<version>1.0.4</version>
<relativePath>../parent</relativePath>
</parent>
<groupId>releasetest</groupId>
<artifactId>artifact2</artifactId>
<packaging>jar</packaging>
parent/pom.xml
--------------
<groupId>releasetest2</groupId>
<artifactId>root</artifactId>
<version>1.0.4</version>
<packaging>pom</packaging>
<properties>
<MAIN.version>${project.version}</MAIN.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>releasetest</groupId>
<artifactId>artifact1</artifactId>
<version>${MAIN.version}</version>
</dependency>
<dependency>
<groupId>releasetest</groupId>
<artifactId>artifact2</artifactId>
<version>${MAIN.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
When I use mvn versions:set while being in parent folder it only updates the parent/pom.xml. I expected it to update root/pom.xml artifact1/pom.xml and artifact2/pom.xml
Is there a way to resolve this?
First please revert version number in the parent pom and make sure that all child poms have the same version.
Then navigate to parent pom directory and execute this command :
mvn versions:set versions:update-child-modules -DnewVersion=<New_Version_Number> -DprocessAllModules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With