简体   繁体   English

对Maven的依赖冲突

[英]Dependency conflicts on maven

If I have some libs that have others dependencies in different versions like this example: commons-logging-1.0.4.jar (omitted for conflict with 1.1.1) and commons-logging-1.1.1.jar. 如果我有一些在不同版本中具有其他依赖项的库,例如本例:commons-logging-1.0.4.jar(与1.1.1冲突时省略)和commons-logging-1.1.1.jar。

What´s the best practice about this, inform the exclusion of this conflict in the related dependency (by tag) or do nothing because the lib was omitted? 关于此的最佳实践是什么(通过标记告知是否排除了相关依赖项中的此冲突),或者因为省略了lib而没有采取任何措施? Is there any problem don´t especify the exclusion of dependencies in the POM ? 是否存在未在POM中排除依赖项的问题?

Example that explain that how to resolve this in the POM, I´m putting the following instruction to resolve the internal conflicts about version: 解释如何在POM中解决此问题的示例,我将按照以下说明解决有关版本的内部冲突:

<dependency>
        <groupId>struts</groupId>
        <artifactId>struts</artifactId>
        <version>1.2.8</version>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
         </exclusions>
    </dependency>
</dependencies>

You need to configure a dependencyManagement section in your [parent] POM. 您需要在[父] POM中配置dependencyManagement部分。 This will coerce artifacts coming as transitive dependencies to be of the specified version. 这将迫使作为传递依赖项的工件成为指定版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM