maven直接依赖于一个项目中同一对象的两个版本

时间:2016-10-19 14:21:31

标签: maven-3 maven-dependency-plugin

我有一个案例,我需要构建可以被视为同一对象的两个版本之间的补丁。我正在使用Maven 3.1.1

<dependency>
    <groupId>my.group.id</groupId>
    <artifactId>artifact1</artifactId>
    <!-- managed version from parent pom -->
    <!-- 1.0.1-SNAPSHOT -->
    <type>zip</type>
</dependency>
<dependency>
    <groupId>my.group.id</groupId>
    <artifactId>artifact1</artifactId>
    <version>1.0.0</version>
    <type>zip</type>
</dependency>

我使用maven-dependency-plugin在构建过程中将它们解压缩到不同的目录中。 exec-maven-plugin用于执行创建本质上是补丁的外部工具。

一切正常。

问题是警告

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for my.group.id:build-patch:pom:1.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: my.group.id:artifact1:zip -> version (?) vs 1.0.0 @ my.group.id:build-patch:[unknown-version], /my/jenkins/workspace/directory/stuff/build-patch/pom.xml, line 163, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]

我知道这只是一个警告

但是我想让构建尽可能干净。另请注意,groupId:artifactId:type:classifier永远不会是唯一的。如何设置它以便没有警告?有没有人怀疑这可能是将来的问题?

0 个答案:

没有答案