If you care, you should add the one that you want to the
dependencyManagement element of your POM rather than trying to
workaround this.
As for Maven itself, I would have expected parent to come first - but
it's not as simple the first level being first, it's rather which is
encountered first - you'll see this via the trace when running with -
X. If you think there's an inconsistency between Maven 2.2.1 and
earlier versions then that might be a bug, but otherwise I would stick
with the resolution it chooses for now.
- Brett
On 02/10/2009, at 9:10 AM, Robert Winch wrote:
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>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]