[ http://jira.codehaus.org/browse/MNG-3197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Gier updated MNG-3197: --------------------------- Attachment: MNG-3197-maven-artifact-r574693.patch Attaching a patch to the issue. Looking at the code, it seems that the order of the list of dependencies for the classpaths is not predictable. This is due to the use of Sets for storing dependencies which don't preserve the order when an iterator is used. The second issue is that the artifact collector uses a depth first traversal of the tree to gather the list. Which means that an artifact several levels deep off the first branch (1st direct dependency) will come before the 2nd direct dependency. The attached patch sorts the dependencies in order of how far they are from the root and stored them in a LinkedHashSet so that this order is preserved. > Direct dependencies should come before transitive dependencies in build > classpath. > ---------------------------------------------------------------------------------- > > Key: MNG-3197 > URL: http://jira.codehaus.org/browse/MNG-3197 > Project: Maven 2 > Issue Type: Improvement > Affects Versions: 2.0.7 > Reporter: Paul Gier > Attachments: MNG-3197-maven-artifact-r574693.patch > > > Currently the transitive dependencies appear to take priority over direct > dependencies in the compile and test classpaths. > For example project A depends on B version 2 and C version 1: > A -> B.2 > A -> C.1 -> B.1 > When the tests are run, the classpath will be in an order similar to: > B.1:C.1:B.2 > Since B.1 comes first in the classpath, it will be used when running the > tests. But it seems that B.2 should be used when testing because it has the > direct dependency. -- 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