[
http://jira.codehaus.org/browse/MNG-4263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Bentmann closed MNG-4263.
----------------------------------
Assignee: Benjamin Bentmann
Resolution: Duplicate
> Dependencies resolution & the order in the declaration
> ------------------------------------------------------
>
> Key: MNG-4263
> URL: http://jira.codehaus.org/browse/MNG-4263
> Project: Maven 2
> Issue Type: Bug
> Components: Dependencies
> Affects Versions: 2.0.8
> Environment: Maven version: 2.0.8
> Java version: 1.5.0_15
> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
> Reporter: Arnaud
> Assignee: Benjamin Bentmann
> Attachments: project-test.zip
>
>
> Hi, I've got som trouble with Maven resolution.
> I read (here :
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> ):
> bq. Dependency mediation - this determines what version of a dependency will
> be used when multiple versions of an artifact are encountered. Currently,
> Maven 2.0 only supports using the "nearest definition" which means that it
> will use the version of the closest dependency to your project in the tree of
> dependencies. You can always guarantee a version by declaring it explicitly
> in your project's POM. Note that if two dependency versions are at the same
> depth in the dependency tree, until Maven 2.0.4 it was not defined which one
> would win, but since Maven 2.0.5 it's the order in the declaration that
> counts: the first declaration wins.
> So what does 'the order in the declaration' mean ? if it is the pom
> declaration i ve got a probleme.
> *I ve got 3 projects :*
> *project-test-a*
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
> <modelVersion>4.0.0</modelVersion>
> <groupId>test</groupId>
> <artifactId>project-test-a</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <description></description>
> <dependencies>
> <dependency>
> <groupId>log4j</groupId>
> <artifactId>log4j</artifactId>
> <version>1.2.8</version>
> </dependency>
> </dependencies>
> </project>
> {code}
> *project-test-b*
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
> <modelVersion>4.0.0</modelVersion>
> <groupId>test</groupId>
> <artifactId>project-test-b</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <description></description>
> <dependencies>
> <dependency>
> <groupId>log4j</groupId>
> <artifactId>log4j</artifactId>
> <version>1.2.7</version>
> </dependency>
> </dependencies>
> </project>
> {code}
> project-test, (use project-test-a and project-test-b)
> {code}
> <dependencies>
> <dependency>
> <groupId>test</groupId>
> <artifactId>project-test-a</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>test</groupId>
> <artifactId>project-test-b</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> </dependency>
> </dependencies>
> {code}
> So the "nearest definition" is not usefull here because they has got the same
> depth.
> So i use the 'the order in the declaration' and for me, the project
> 'project-test-a' is above the 'b'
> So the top project (project-test) must use the LOG4J:1.2.8 no ????
> {code}
> D:\CNT2\wk\wkTest\project-test>mvn dependency:tree
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'dependency'.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Unnamed - test:project-test:jar:0.0.1-SNAPSHOT
> [INFO] task-segment: [dependency:tree]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] snapshot test:project-test-b:0.0.1-SNAPSHOT: checking for updates from
> inhouse_snapshots
> [INFO] snapshot test:project-test-a:0.0.1-SNAPSHOT: checking for updates from
> inhouse_snapshots
> [INFO] [dependency:tree]
> [INFO] test:project-test:jar:0.0.1-SNAPSHOT
> [INFO] +- test:project-test-b:jar:0.0.1-SNAPSHOT:compile
> [INFO] | \- log4j:log4j:jar:1.2.7:compile
> [INFO] \- test:project-test-a:jar:0.0.1-SNAPSHOT:compile
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 6 seconds
> [INFO] Finished at: Tue Jul 28 15:23:22 CEST 2009
> [INFO] Final Memory: 8M/17M
> [INFO]
> ------------------------------------------------------------------------
> {code}
> Where is the problemes ???
> Thx
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira