Steven Schlansker created MNG-5731: -------------------------------------- Summary: DefaultArtifactCollector loses a transitive dependency with specific combination of versions and RUNTIME scope Key: MNG-5731 URL: https://jira.codehaus.org/browse/MNG-5731 Project: Maven Issue Type: Bug Components: Dependencies Affects Versions: 3.2.3 Environment: Mac OS 10.9, Java 8u25 Reporter: Steven Schlansker Attachments: maven-loses-transitive-dependency.tgz
Unpack the attached test case. It is a rather large multimodule project which looks like the following: {code} test:i:jar:1 (0; enabled) test:c:jar:3:compile (1; enabled) test:b:jar:2:compile (2; enabled) test:e:jar:2:compile (1; enabled) test:c:jar:2:compile (2; disabled) test:b:jar:1:compile (3; disabled) test:a:jar:1:compile (4; disabled) test:h:jar:1:runtime (2; enabled) test:g:jar:1:runtime (3; enabled) test:a:jar:2:compile (4; disabled) test:f:jar:1:compile (1; enabled) test:e:jar:1:compile (2; disabled) test:c:jar:1:compile (3; disabled) test:d:jar:1:compile (2; enabled) test:c:jar:2:compile (3; disabled) test:b:jar:1:compile (4; disabled) test:a:jar:2:compile (5; disabled) {code} There is a dependency chain I1 -> E2 -> H1 -> G1(runtime) -> A2 During version resolution, the G1->A2 dependency is dropped due to checkScopeUpdate in favor of upgrading the version of B1 -> A1 into B1 -> A2, since it has compile scope. The B1 -> A2 dependency is later suppressed because C3 has a "nearer" dependency on B2, tossing B1. So A2 is lost even though there is a legitimate need for it from G1. To reproduce: {code} [steven@Anesthetize:~/ot-code/maven-loses-transitive-dependency]% mvn clean package && java -cp i1/target/i-1-jar-with-dependencies.jar MainI Exception in thread "main" java.lang.NoClassDefFoundError: A at G.<init>(G.java:2) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at java.lang.Class.newInstance(Class.java:433) at H.<clinit>(H.java:6) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:259) at E.<init>(E.java:5) at MainI.main(MainI.java:3) Caused by: java.lang.ClassNotFoundException: A at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 11 more {code} -- This message was sent by Atlassian JIRA (v6.1.6#6162)