5

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>
ricardo
  • 621
  • 1
  • 11
  • 22
  • I don't understand your question yet, so could you provide the following information: maven version you want to use (2.2.x vs. 3.0.x). I think the answer depends on the different versions. Perhaps the question could not be answered at all, because the problem lays in the different versions, if they are compatible or not for you usage. – mliebelt Mar 13 '11 at 13:18
  • I´m using maven 3.0, My project was using ANT and I was doing the refactoring to maven and I need some libs of others internal projects that have more dependencies libs. – ricardo Mar 14 '11 at 14:23
  • When I visualize the “Dependency Hierarchy”, I noted some different versions of same libs like this example above and Maven set the old versions as “omitted for conflict with [version]”. Thus, I want to know what is correct to do. – ricardo Mar 14 '11 at 14:25
  • Did you try my suggestion? That's exactly what the `dependencyManagement` tag is for. – skuro Mar 14 '11 at 15:07

1 Answers1

6

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.

skuro
  • 13,414
  • 1
  • 48
  • 67