Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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>
like image 567
ricardo Avatar asked Mar 11 '11 20:03

ricardo


1 Answers

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.

like image 126
skuro Avatar answered Sep 28 '22 17:09

skuro