[ 
https://issues.apache.org/jira/browse/MDEP-610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16465886#comment-16465886
 ] 

Michael Osipov commented on MDEP-610:
-------------------------------------

Please provide a sample project for this.

> Dependency order : Depending on transitive version instead of declared based 
> on order of declaration
> ----------------------------------------------------------------------------------------------------
>
>                 Key: MDEP-610
>                 URL: https://issues.apache.org/jira/browse/MDEP-610
>             Project: Maven Dependency Plugin
>          Issue Type: Bug
>         Environment: mvn -v 
> Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 
> 2015-03-14T04:10:27+08:00)
> Maven home: /home/cp/...../apache-maven-3.3.1
> Java version: 1.8.0_121, vendor: Oracle Corporation
> Java home: /home/cp/...../oracle-jdk-1.8.0_121/jre
> Default locale: en_SG, platform encoding: UTF-8
> OS name: "linux", version: "4.4.0-122-generic", arch: "amd64", family: "unix"
>            Reporter: Chandra Prakash
>            Priority: Minor
>
> h3. *Overview :* 
> The order of dependency declaration in the pom is taking precedence instead 
> of depth. 
> h3. *Example Scenario :* 
> There are two modules. *test-a* and *test-b*
> *test-a* (depends on javax.servlet-api:2.5)
> *test-b* (depends on test-a)
> I want to use 3.1.0 version of above library in test-b. However, if test-a is 
> declared before ***javax.servlet-api*, executing *mvn clean package* fails. 
> {code:xml}
> <!-- NG : Reads 2.5 version of javax.servlet-api -->
> <dependency>
> <groupId>com.cp.test</groupId>
> <artifactId>test-a</artifactId>
> <version>${com.cp.test.version}</version>
> </dependency>
> <dependency>
> <groupId>javax.servlet</groupId>
> <artifactId>javax.servlet-api</artifactId>
> <version>3.1.0</version>
> </dependency>
> {code}
> If I change the ordering, it works fine. 
> {code:xml}
> <!-- OK : Reads 3.1.0 version of javax.servlet-api -->
> <dependency>
> <groupId>javax.servlet</groupId>
> <artifactId>javax.servlet-api</artifactId>
> <version>3.1.0</version>[link title|http://example.com]
> </dependency>
> <dependency>
> <groupId>com.cp.test</groupId>
> <artifactId>test-a</artifactId>
> <version>${com.cp.test.version}</version>
> </dependency>
> {code}
> The documentation at : 
> [https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html]
>  > the current pom's declaration takes precedence over its parent's 
> declaration.
> However, current pom declaration is not taking precedence *when ordered 
> differently* (as above pom)
> Could you please confirm. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to