Thanks to both of you for your responses. I am aware that it is preferred to
add the dependency as a direct dependency to avoid such conflicts (thank you
for that suggestion).

Sorry to keep this going, but I am still puzzled to what is causing the
discrepancy and would like to get to the bottom of it. I use m2eclipse for
development and maven 2.2.1 for continuous builds. This would work better if
both were consistent. I know that m2eclipse uses Maven 3,  but as I
understand it (I could be wrong) Maven 3 is suppose to be almost, if not
entirely, passive to an end user; I believe only plugin developers using
dependency management APIs are suppose to be impacted. In short, does anyone
know:

Is this expected behavior (I would hope that it should be consistent since
Maven aims at providing consistent builds)?
Is this a bug in Maven 2.2.1?
Is this a bug in m2eclipse (Maven 3)?
Does this question belong on m2eclipse mailing list instead?

Thanks,
Rob


On Thu, Oct 1, 2009 at 7:30 PM, Brian Fox <[email protected]> wrote:

> 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]
>
>

Reply via email to