There is a discrepancy in how m2eclipse (latest stable) resolves a version
of a dependency and Maven 2.2.1 does and I am trying to figure out which is
correct. I understand that the "nearest dependency" is suppose to be the
version that is resolved [1]. I also understand that the first defined
dependency is used if the depth is the same (Maven 2.0.9 or later). However,
I am not sure which is resolved if the depth is the same and one is defined
in a parent and the other in the child. I have copied the simplified example
that reproduces the discrepancy in below [2]. The issue is that
spring-webflow-1.0.6.jar (located in the parent) defines
spring-core-2.0.7.jar as a direct dependency and spring-aop-2.5.6.jar
(located in the child) defines spring-core-2.5.6.jar as a direct dependency.
Which version of spring-core should be resolved? The m2eclipse plugin
resolves spring-core-2.0.7.jar and Maven 2.2.1 resolves
spring-core-2.5.6.jar.

Thanks in advance :)

[1]
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Transitive_Dependencies

[2]

parent

<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>parent</groupId>
    <artifactId>parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webflow</artifactId>
            <version>1.0.6</version>
        </dependency>
    </dependencies>
</project>

child

<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
    <parent>
        <artifactId>parent</artifactId>
        <groupId>parent</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>child</groupId>
    <artifactId>child</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>2.5.6</version>
        </dependency>
    </dependencies>
</project>

Reply via email to