[ https://jira.codehaus.org/browse/MNG-5188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=340231#comment-340231 ]
Kai Lehmann commented on MNG-5188: ---------------------------------- As I'm not owner of this task, I cannot reopen. I'll crete a new task. > Test scope dependency incorrectly promoted to compile scope > ----------------------------------------------------------- > > Key: MNG-5188 > URL: https://jira.codehaus.org/browse/MNG-5188 > Project: Maven 2 & 3 > Issue Type: Bug > Components: Dependencies > Affects Versions: 3.0.3 > Environment: Linux 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 > UTC 2011 x86_64 x86_64 x86_64 GNU/Linux > java version "1.6.0_23" > OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5) > OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode) > Reporter: Harald Wellmann > Attachments: junit-transitive.zip > > > I'm having a strange issue where a module with three dependencies has an > unexpected transitive dependency on JUnit with compile scope (where test > scope would be expected). > I've isolated this problem in a small example project which is attached. > My module2 depends on > 1) module1 > 2) test-deps > 3) module1:test-jar > module1 depends on Apache OpenJPA which has a compile scope transitive > dependency on JUnit (not really needed, I think, but that's the way it was > released). module1 also has a test scope dependency on JUnit for its own > JUnit tests. > As I don't want a compile scope dependency on JUnit in my module2, I use an > <exclude> for JUnit. > test-deps has POM packaging, it simply collects the test dependencies I > normally need in all modules of my project. test-deps uses the default > compile scope for each dependency (junit and spring-test in this example). > module2 has a test scope dependency on test-deps, so by Maven transitive > scope resolution, the junit dependency is propagated to module2 with test > scope. > Since some of the module2 JUnit tests are derived from base classes in module > 1, module2 depends on the test-jar of module1 with scope test. > Thus, none of the three dependencies should cause a compile scope dependency > on junit, but the combination of the three seems to have some fatal effect. > This looks like a bug in Maven's dependency scope resolution. > To reproduce, unpack the attachment, cd to junit-transitive, run mvn -X clean > install and look at the compile classpath for module2 in the log. -- This message was sent by Atlassian JIRA (v6.1.6#6162)