Dependency Management precedence issue over Dependency Mediation for Transitive Dependencies ---------------------------------------------------------------------------------------------
Key: MNG-4797 URL: http://jira.codehaus.org/browse/MNG-4797 Project: Maven 2 & 3 Issue Type: Bug Components: Dependencies Affects Versions: 2.2.1 Reporter: Ramiah Balasubramanian Attachments: Dependency-Declaration-of-Child-Pom.xml, Dependency-Management-Extract-of-Parent-Pom.xml, spring-actionscript-superpom-1.0.pom My usecase mirrors the scenario described through an example in [http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management], in particular, {quote} b is defined in B's parent's dependency management section and since dependency management takes precedence over dependency mediation for transitive dependencies, version 1.0 will be selected should it be referenced in a or c's pom. b will also have compile scope. {quote} However, I am unable to see the above behaviour unless I define explicit dependency for the transitive dependencies in the child pom. My parent pom defines a <dependencyManagement/> section with all the dependencies (scope, version) that is necessary for my child project directly and indirectly (to override the transitive dependency of a an external artifact - (spring-actionscript-core whose parent pom is spring-actionscript-superpom-1.0.pom). The transitive dependencies of the spring-actionscript-core artifact are defined with a different version to the one I have defined within the <dependencyManagement/> section of my parent pom. According to the precedence rules, the transitive dependencies of the spring-actionscript-core artifact should be overridden by the version and scope defined in the <dependencyManagement/> section of my parent pom. >From the maven install execution log, I do not see that as the case. For those >artifacts I have explicitly defined within the <dependencies/> section of the >child pom, the transitive dependencies attributes have been overridden with >those defined in the <dependencyManagement/> section of the parent pom, albeit >looks like it is through mediation than management. Example artifacts are com.adobe.flex.framework:framework:swc:3.5.0.12683:runtime (removed - nearer found: 4.1.0.16076) com.adobe.flex.framework:rpc:swc:3.5.0.12683:runtime (removed - nearer found: 4.1.0.16076) However, for those that are not explicitly defined, the transitive dependencies remain with the version defined within the external artifact's pom. Dependency mediation seems to rule. com.adobe.flex.framework:utilities:swc:3.5.0.12683:runtime (setting scope to: compile) com.adobe.flex.framework:framework:rb.swc:3.5.0.12683:runtime (setting scope to: compile) The debug output of maven install execution is as below: *[DEBUG]* *org.springextensions.actionscript:spring-actionscript-core:swc:1.0:compile (selected for compile)* [DEBUG] com.adobe.flex.framework:flex:swc:3.5.0.12683:runtime (setting scope to: compile) [DEBUG] com.adobe.flex.framework:framework:swc:3.5.0.12683:runtime (removed - nearer found: 4.1.0.16076) [DEBUG] com.adobe.flex.framework:framework:zip:configs:4.1.0.16076:compile (removed - nearer found: 3.5.0.12683) [DEBUG] com.adobe.flex.framework:framework:zip:configs:3.5.0.12683:compile (selected for compile) [DEBUG] com.adobe.flex.framework:rpc:swc:3.5.0.12683:runtime (removed - nearer found: 4.1.0.16076) [DEBUG] com.adobe.flex.framework:utilities:swc:3.5.0.12683:runtime (setting scope to: compile) [DEBUG] com.adobe.flex.framework:playerglobal:swc:10:3.5.0.12683:runtime (selected for runtime) [DEBUG] com.adobe.flex.framework:framework:rb.swc:3.5.0.12683:runtime (setting scope to: compile) [DEBUG] com.adobe.flex.framework:rpc:rb.swc:3.5.0.12683:runtime (setting scope to: compile) I have attached the following extracts for your perusal: i) Dependency Management section of the parent pom ii) Dependency declarations of the child pom iii) Pom of an external artifact that the child pom defines dependency If my understanding of the intended behaviour is flawed, apologies in advance, much appreciate if you could provide me with an explanation to help understand better. -- 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