[ https://jira.codehaus.org/browse/MNG-5188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=283271#comment-283271 ]
Sophie Ramel commented on MNG-5188: ----------------------------------- I have the same problem (or very similar) with the "provided" scope and another dependency (jaxb-api), reproduced on a simple example: I have a "sdk" project (that is, a project of type pom, used to group together a number of dependencies) declaring jaxb-api and jaxws-api with compile scope. This sdk is used in another (jar) project with scope "provided", so that resulting dependencies should be "provided". In my other project I have a dependency to jaxws-api in compile scope where I manually exclude jaxb-api. When I type "mvn dependency:resolve", jaxb-api is resolved to scope "compile". The workaround is also to exclude jaxb-api from jaxws-api dependency in my sdk. > 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 is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira