我有一个maven项目,它有大量的子项目,这些子项目有许多依赖项。现在我想更新我的所有版本的pom文件到一个新的版本,并重建它们。例如,如果我有一个这样的pom:
<parent>
<groupId>theparentId</groupId>
<artifactId>theParentArtifact</artifactId>
<version>2.0</version>
<relativePath>..</relativePath>
</parent>
<artifactId>eaics-wsa-model</artifactId>
<packaging>model</packaging>
<dependencies>
<dependency>
<groupId>groupId1</groupId>
<artifactId>artifactId1</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>groupId2</groupId>
<artifactId>artifactId2</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>groupId3</groupId>
<artifactId>artifactId3</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
我需要将groupId1到groupId3的依赖项更新到一个不存在的新版本。因为我还需要自己“创建”一个新的更新版本。
因为他们的pom.xml中的依赖关系现在看起来是这样的:
<groupId>groupId3</groupId>
<artifactId>artifactId3</artifactId>
<version>1.2</version>
如您所见,版本是1.2,但在依赖项使用它之前需要更新到1.3。
那么,有没有一种方法可以递归地更新所有的pom(版本)呢?如果可以在Java中使用MavenXpp3Reader等。太好了。但是还有更简单的方法吗?因为我担心的是,在那之后我不能构建我的项目,因为我认为它们不会递归地构建,也不会找到新的依赖版本。
2条答案
按热度按时间gudnpqoy1#
您可以使用versions-maven-plugin更新所有pom的版本这里有一些例子可以帮助您。
7y4bm7vi2#
更新链接:https://www.mojohaus.org/versions/versions-maven-plugin/index.html更新所有版本的命令是
mvn versions:use-latest-versions