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

perdjesk commented on MRESOLVER-391:
------------------------------------

In the current state of your example, for dependency acme-lib-c the issues that 
might arise from difference between 1.0.0 and 2.0.0 version selection will be 
similar in test and runtime classpath as the dependency has been selected in 
compile scope. As such the example is consistent in test and runtime.
{code:java}
[INFO] --- dependency:3.6.0:tree (default-cli) @ acme-product-a ---
[INFO] org.acme:acme-product-a:jar:1.0.0-SNAPSHOT
[INFO] +- org.acme:acme-lib-d:jar:1.0.0-SNAPSHOT:test
[INFO] |  \- org.acme:acme-lib-c:jar:2.0.0-SNAPSHOT:compile
[INFO] \- org.acme:acme-lib-b:jar:1.0.0-SNAPSHOT:compile{code}
By adding the following patch in the pom.xml of product-a 
{code:java}
--- a/product-a/pom.xml
+++ b/product-a/pom.xml
@@ -20,6 +20,12 @@
       <artifactId>acme-lib-b</artifactId>
       <version>1.0.0-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.acme</groupId>
+      <artifactId>acme-lib-c</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>{code}
The dependency acme-lib-c is now selected with scope test and will not be 
present at runtime and leads to CNFEx at runtime for any code of acme-lib-b 
that depends on those. However everything will be fine during testing.
{code:java}
[INFO] --- dependency:3.6.0:tree (default-cli) @ acme-product-a ---
[INFO] org.acme:acme-product-a:jar:1.0.0-SNAPSHOT
[INFO] +- org.acme:acme-lib-d:jar:1.0.0-SNAPSHOT:test
[INFO] +- org.acme:acme-lib-b:jar:1.0.0-SNAPSHOT:compile
[INFO] \- org.acme:acme-lib-c:jar:1.0.0-SNAPSHOT:test
{code}

> Scope mediation improvements
> ----------------------------
>
>                 Key: MRESOLVER-391
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-391
>             Project: Maven Resolver
>          Issue Type: Bug
>          Components: Resolver
>            Reporter: Tamas Cservenak
>            Priority: Major
>             Fix For: 2.0.0
>
>
> As per MNG-5988: if an artifact in "test" scope is found nearer, but in scope 
> "compile" is found deeper in graph, the "test" scope wins. This at runtime 
> may lead to CNFEx.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to