是否有maven插件可以验证传递依赖项的冲突版本,确保我不依赖于同一工件的不同版本?
理想情况下,我会挂钩compile
生命周期,如果我导入依赖关系A的版本X和Y,它将无法构建。
答案 0 :(得分:2)
你可以使用maven-enforcer-plugin来实现。以下配置将导致版本在版本冲突时失败:
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<DependencyConvergence/>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
以下是更多详情:
http://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html