maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Scholte" <rfscho...@apache.org>
Subject Re: maven-wagon git commit: [MRESOLVER-9] DefaultDependencyCollector does not correctly handle dependency management.
Date Fri, 16 Dec 2016 14:21:54 GMT
On Thu, 15 Dec 2016 23:39:50 +0100, Christian Schulte <cs@schulte.it>  
wrote:

> Am 12/15/16 um 23:28 schrieb Christian Schulte:
>> different thing. Think about the dependency management as a global
>> override of everything. That's how the resolver works. That's my
>
> Maven does it that way since 2.0.something. Take a look at this pom:
> <http://repo.maven.apache.org/maven2/junit/junit/4.12/junit-4.12.pom>.
> You'll see it declares a dependency on hamcrest-core in version 1.3.
> Here is a pom managing that version to 1.1.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>localhost</groupId>
>   <artifactId>test</artifactId>
>   <version>1.0-SNAPSHOT</version>
>   <packaging>jar</packaging>
>   <dependencyManagement>
>     <dependencies>
>       <dependency>
>         <groupId>org.hamcrest</groupId>
>         <artifactId>hamcrest-core</artifactId>
>         <version>1.1</version>
>       </dependency>
>     </dependencies>
>   </dependencyManagement>
>   <dependencies>
>     <dependency>
>       <groupId>junit</groupId>
>       <artifactId>junit</artifactId>
>       <version>4.12</version>
>     </dependency>
>   </dependencies>
> </project>
>
> Run mvn -X dependency:tree on that pom. You'll see that the version of
> the transitive dependency of junit will have been managed to what I put
> into that pom. That's exactly what I would expect to happen.
>
> [INFO] localhost:test:jar:1.0-SNAPSHOT
> [INFO] \- junit:junit:jar:4.12:compile
> [INFO]    \- org.hamcrest:hamcrest-core:jar:1.1:compile (version managed
> from 1.3)
>
>

this is indeed expected behaviour: You are using classes from junit, not  
 from hamcrest-core; you want a different version from hamcrest-core, so  
dependencyManagement is the place to specify it.

but this cover the issue we are talking about, because IIUC you are saying  
that IF both junit and hamcrest get the test-scope AND hamcrest would have  
a dependency THEN that dependency is not added to the classpath. That is  
still unexpected behavior.

Robert

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message