[ http://jira.codehaus.org/browse/MNG-3033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
hugo lassiege reopened MNG-3033: -------------------------------- It seems that Mike Perham already noticed the problem in this comment : http://jira.codehaus.org/browse/MNG-1577#action_79208 Here is a pom to reproduce the thing : Example of pom father : <?xml version="1.0" encoding="UTF-8"?><project> <modelVersion>4.0.0</modelVersion> <groupId>A</groupId> <artifactId>Father A</artifactId> <name>Father A</name> <version>1.0</version> <packaging>pom</packaging> <description>Pom Father</description> <dependencyManagement> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </dependencyManagement> </project> Child B <?xml version="1.0" encoding="UTF-8"?><project> <parent> <groupId>A</groupId> <artifactId>FatherA</artifactId> <version>1.0</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>ChildB</artifactId> <name>ChildB</name> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.2</version> <scope>compile</scope> </dependency> </dependencies> </project> If I use mvn help:effective-pom, I have what I expect : ... <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.2</version> <scope>compile</scope> </dependency> </dependencies> <reporting> <outputDirectory>target/site</outputDirectory> </reporting> <dependencyManagement> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </dependencyManagement> ... and in the documentation (http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html) It is said that : dependency management takes precedence over dependency mediation and also because the current pom's declaration takes precedence over its parent's declaration. Maybe I'm wrong, but I understand that maven calculate the dependencies with a distance algorithm. The version and scope should be taken from the closest distance. transitive dependencies is far than dependency management and current pom declaration should take precedence over all parent's declaration. So, in the example above, I should get junit-3.8.2 in scope compile (required in current pom). I get junit-3.8.1 in scope compile. Scope was correctly overriden, but not the version. > DependencyManagement override version if declared in child > ---------------------------------------------------------- > > Key: MNG-3033 > URL: http://jira.codehaus.org/browse/MNG-3033 > Project: Maven 2 > Issue Type: Bug > Components: Dependencies > Affects Versions: 2.0.5, 2.0.6 > Reporter: hugo lassiege > > Hi, > I'm currently in maven 2.0.5 but I tried in 2.0.6 > If I declare a dependency in a father pom within a dependencyManagement like > this : > <dependency> > <groupId>A</groupId> > <artifactId>A</artifactId> > <version>1.0</version> > </dependency> > and if I want to override the version in the child : > <dependency> > <groupId>A</groupId> > <artifactId>A</artifactId> > <version>1.1</version> > </dependency> > I get the version 1.0. It seems it was already reported in this issue : > http://jira.codehaus.org/browse/MNG-1577 but was not the main purpose and was > not fixed. > Regards. -- 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