Interpreting "omitted for conflict" in maven 2 dependency tree

I've found the answer by myself at http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html: "if two dependency versions are at the same depth in the dependency tree, until Maven 2.0.8 it was not defined which one would win, but since Maven 2.0.9 it's the order in the declaration that counts: the first declaration wins".

It seems a very questionable strategy to me. :-\


if two dependency versions are at the same depth in the dependency tree, or if not at the same depth which is more closure to the project will be pointed to the Project.

There are Two solutions To resolve that once you know your dependency depth.

First: if those dependencies are included as part of another project in the library you can remove them manually, But you don't want your project to point that dependency as it was point due to being closest to your project. You can exclude jar of particular project as shown below in your project pom.xml

 <dependency>
        <groupId>org.cassandraunit</groupId>
        <artifactId>cassandra-unit</artifactId>
        <version>3.1.3.2</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

Second: You directly add the jar of the expected version in the pom.xml of your project. Then that would be the closest jar to your project.

Using Both ways mentioned above you can solve the problem.