我有这个dependencyManagement在我的多模块项目我父POM:检查依赖性版本在多模块Maven项目
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>A</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>B</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>C</artifactId>
<version>1.1</version>
</dependency>
</dependencyManagement>
而这每一个孩子模块POM:
模块A:
<parent>
<groupId>${project.groupId}</groupId>
<artifactId>ParentId</artifactId>
<version>1.0</version>
</parent>
<artifactId>A</artifactId>
<version>3.5</version>
<packaging>nbm</packaging>
模块B:
<parent>
<groupId>${project.groupId}</groupId>
<artifactId>ParentId</artifactId>
<version>1.0</version>
</parent>
<artifactId>B</artifactId>
<version>1.0</version>
<packaging>nbm</packaging>
模块C:
<parent>
<groupId>${project.groupId}</groupId>
<artifactId>ParentId</artifactId>
<version>1.0</version>
</parent>
<artifactId>C</artifactId>
<version>1.1</version>
<packaging>nbm</packaging>
,我们要释放每一次,我们要检查每一个孩子模块中的版本是一样的,在dependencyManagement版本(开发者被要求在这两个地方需要修改版本每次他们改变一些东西)。
有一些方法可以检查版本是否相同automaticaly?如果版本不一样,我怎么能自动更改它们?
不应该模块B和C的artifactId是'B'和'C'? – vikingsteve
您应该考虑在父pom中的maven属性中定义版本并引用您的子模块中的属性。这样他们将全部同步。 – User2709
如果你有一个多模块构建每个模块/孩子应该有与父母相同的版本,所以你违反了多模块构建的想法,导致你有问题。 – khmarbaise