Neither. The parent is merged into the child before any of this is considered. In other words, the effective-pom is produced before nearest wins is even remotely considered. That said, a given value in the child overrides one defined in the parent....but this doesn't have anything directly to do with selecting something based on the depth in the transitive tree.
On Thu, Oct 1, 2009 at 4:10 PM, Robert Winch <[email protected]> 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]
