我正面临着使用versions:set
更改聚合器maven项目的版本及其具有的两个模块的需求。其中一种用例无法正常工作,我不知道我是否缺少某些东西,或者该用例特别不受插件的支持。子模块版本未更新为1.4.0,因为它们将与someother-parentartifact-1
和someother-parentartifact-2
的版本匹配。我无法使用不同于1.4.0
的版本来重现该问题,因此我猜想该插件会以某种方式引起混淆。
聚合器:
<?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>
模块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>
模块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>
一些见解:
maven.deploy.skip
的值不会改变结果。1.4.0
)与子模块的父模块的版本匹配时,我才看到这种情况。mvn versions:set -DgenerateBackupPoms=false -DnewVersion=1.4.0 -DprocessAllModules
。update-child-modules
。没有成功。一些日志:
[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] ------------------------------------------------------------------------
预先感谢您的帮助。
答案 0 :(得分:0)
我已经使用mvn versions:set -DgenerateBackupPoms=false -DnewVersion=1.4.0 -DoldVersion=* -DgroupId=* -DartifactId=*