[ https://jira.codehaus.org/browse/MNG-5404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=324243#comment-324243 ]
Robert Balazsi commented on MNG-5404: ------------------------------------- I've found two documents with mutually exclusive specifications regarding this: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope -> nearest="provided", farthest="compile" => result="provided" (as you described) http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-Scoperesolution -> ... => result="compile" I'm not sure which one should be respected. Let's assume that the result should be "provided", as you pointed out. Note then, that "mvn dependency:tree" displays the correct result. After some investigation, I found that this is because DefaultDependencyTreeBuilder uses DefaultArtifactCollector (in the "maven-artifact" project) that does some scope update (has a method checkScopeUpdate(...), etc.). However, the AbstractDependencyFilterMojo (which the non-direct base class of ResolveDependenciesMojo that is called on "mvn dependency:resolve") relies on "project.getArtifacts()" filled previously by the DefaultProjectDependenciesResolver, which in turn, calls Aether's DefaultRepositorySystem.resolveDependencies(...) method. This method resolves the scope conflict in question as "compile" so I guess Aether implements it a different way. Note that there are several issues (such as MNG-5188 and MNG-5145) that are related to dependency scope resolution. Actually, I'm not that familiar with the code, I was just debugging to see how it works. :-) > Wrong resolution of dependency scope by Maven 3 > ----------------------------------------------- > > Key: MNG-5404 > URL: https://jira.codehaus.org/browse/MNG-5404 > Project: Maven 2 & 3 > Issue Type: Bug > Components: Dependencies > Affects Versions: 3.0.4 > Reporter: Dmitry Batrak > Attachments: build.log > > > For the following POM: > {noformat} > <project> > <modelVersion>4.0.0</modelVersion> > <groupId>test</groupId> > <artifactId>A</artifactId> > <version>1.0</version> > <dependencies> > <dependency> > <groupId>org.apache.axis2</groupId> > <artifactId>axis2-xmlbeans</artifactId> > <version>1.5</version> > <scope>provided</scope> > </dependency> > <dependency> > <groupId>org.apache.axis2</groupId> > <artifactId>axis2-codegen</artifactId> > <version>1.5</version> > <exclusions> > <exclusion> > <groupId>org.apache.geronimo.specs</groupId> > <artifactId>geronimo-stax-api_1.0_spec</artifactId> > </exclusion> > </exclusions> > </dependency> > </dependencies> > </project> > {noformat} > running 'mvn dependency:resolve' using Maven 3.0.4 yields a wrong result. > Namely, geronimo-stax-api_1.0_spec dependency is reported as having the > resolved scope of 'compile'. With Maven 2.2.1 I get the 'provided' scope, as > expected. > Debug log is attached. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira