Dependency conflicts on maven

2019-05-02 07:30发布

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.

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? Is there any problem don´t especify the exclusion of dependencies in the 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:

<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>

1条回答
Bombasti
2楼-- · 2019-05-02 07:30

You need to configure a dependencyManagement section in your [parent] POM. This will coerce artifacts coming as transitive dependencies to be of the specified version.

查看更多
登录 后发表回答