我对此做了很多研究,但到目前为止无法解决。
我有以下结构,
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?