[jira] [Commented] (MNG-5188) Test scope dependency incorrectly promoted to compile scope
[ https://issues.apache.org/jira/browse/MNG-5188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15991321#comment-15991321 ] Robert Scholte commented on MNG-5188: - [~atomashpolskiy] The project to this issue gives the following output, which is as expected. MNG-6224 is a different usecase. {noformat} [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ module2 --- [DEBUG] Configuring mojo org.apache.maven.plugins:maven-compiler-plugin:3.1:compile from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1, parent: sun.misc.Launcher$AppClassLoader@1174ec5] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:3.1:compile' with basic configurator --> [DEBUG] (f) basedir = E:\tmp-help\junit-transitive\module2 [DEBUG] (f) buildDirectory = E:\tmp-help\junit-transitive\module2\target [DEBUG] (f) classpathElements = [E:\tmp-help\junit-transitive\module2\target\classes, E:\tmp-help\junit-transitive\module1\target\module1-0.0.1-SNAPSHOT.jar, d:\maven_repo\.m2\repository\org\apache\openjpa\openjpa\2.1.1\openjpa-2.1.1.jar, d:\maven_repo\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar, d:\maven_repo\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar, d:\maven_repo\.m2\repository\net\sourceforge\serp\serp\1.13.1\serp-1.13.1.jar, d:\maven_repo\.m2\repository\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1.1\geronimo-jms_1.1_spec-1.1.1.jar, d:\maven_repo\.m2\repository\org\apache\geronimo\specs\geronimo-jta_1.1_spec\1.1.1\geronimo-jta_1.1_spec-1.1.1.jar, d:\maven_repo\.m2\repository\commons-pool\commons-pool\1.5.4\commons-pool-1.5.4.jar, d:\maven_repo\.m2\repository\org\apache\geronimo\specs\geronimo-jpa_2.0_spec\1.1\geronimo-jpa_2.0_spec-1.1.jar] [DEBUG] (f) compileSourceRoots = [E:\tmp-help\junit-transitive\module2\src\main\java] [DEBUG] (f) compilerId = javac [DEBUG] (f) debug = true [DEBUG] (f) failOnError = true [DEBUG] (f) forceJavacCompilerUse = false [DEBUG] (f) fork = false [DEBUG] (f) generatedSourcesDirectory = E:\tmp-help\junit-transitive\module2\target\generated-sources\annotations [DEBUG] (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.1:compile {execution: default-compile} [DEBUG] (f) optimize = false [DEBUG] (f) outputDirectory = E:\tmp-help\junit-transitive\module2\target\classes [DEBUG] (f) projectArtifact = com.example:module2:jar:0.0.1-SNAPSHOT [DEBUG] (f) showDeprecation = false [DEBUG] (f) showWarnings = false [DEBUG] (f) skipMultiThreadWarning = false [DEBUG] (f) source = 1.5 [DEBUG] (f) staleMillis = 0 [DEBUG] (f) target = 1.5 [DEBUG] (f) useIncrementalCompilation = true [DEBUG] (f) verbose = false [DEBUG] (f) mavenSession = org.apache.maven.execution.MavenSession@7557b9e [DEBUG] (f) session = org.apache.maven.execution.MavenSession@7557b9e [DEBUG] -- end configuration -- [DEBUG] Using compiler 'javac'. [DEBUG] Source directories: [E:\tmp-help\junit-transitive\module2\src\main\java] [DEBUG] Classpath: [E:\tmp-help\junit-transitive\module2\target\classes E:\tmp-help\junit-transitive\module1\target\module1-0.0.1-SNAPSHOT.jar d:\maven_repo\.m2\repository\org\apache\openjpa\openjpa\2.1.1\openjpa-2.1.1.jar d:\maven_repo\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar d:\maven_repo\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar d:\maven_repo\.m2\repository\net\sourceforge\serp\serp\1.13.1\serp-1.13.1.jar d:\maven_repo\.m2\repository\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1.1\geronimo-jms_1.1_spec-1.1.1.jar d:\maven_repo\.m2\repository\org\apache\geronimo\specs\geronimo-jta_1.1_spec\1.1.1\geronimo-jta_1.1_spec-1.1.1.jar d:\maven_repo\.m2\repository\commons-pool\commons-pool\1.5.4\commons-pool-1.5.4.jar d:\maven_repo\.m2\repository\org\apache\geronimo\specs\geronimo-jpa_2.0_spec\1.1\geronimo-jpa_2.0_spec-1.1.jar] [DEBUG] Output directory: E:\tmp-help\junit-transitive\module2\target\classes [DEBUG] CompilerReuseStrategy: reuseCreated [DEBUG] useIncrementalCompilation enabled [DEBUG] Stale source detected: E:\tmp-help\junit-transitive\module2\src\main\java\module2\Foo.java [INFO] Changes detected - recompiling the module! [DEBUG] Classpath: [DEBUG] E:\tmp-help\junit-transitive\module2\target\classes [DEBUG] E:\tmp-help\junit-transitive\module1\target\module1-0.0.1-SNAPSHOT.jar [DEBUG] d:\maven_repo\.m2\repository\org\apache\openjpa\openjpa\2.1.1\openjpa-2.1.1.jar [DEBUG] d:\maven_repo\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar [DEBUG] d:\maven_repo\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar [DEBUG] d:\maven_repo\.m2\repository\net\sourceforge\serp\serp\1.13.1\serp-1.13.1.jar [DEBUG]
[jira] [Commented] (MNG-5188) Test scope dependency incorrectly promoted to compile scope
[ https://issues.apache.org/jira/browse/MNG-5188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15989869#comment-15989869 ] Andrei Tomashpolskiy commented on MNG-5188: --- [~rfscholte], Apparently this is broken again (checked in 3.3.9 and 3.5.0). See MDEP-558 for a runnable example. Also see MNG-6058 in case this task cannot be re-opened. > Test scope dependency incorrectly promoted to compile scope > --- > > Key: MNG-5188 > URL: https://issues.apache.org/jira/browse/MNG-5188 > Project: Maven > 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 >Assignee: Robert Scholte > Fix For: 3.1.0 > > 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 > 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.3.15#6346)
[jira] Commented: (MNG-5188) Test scope dependency incorrectly promoted to compile scope
[ https://jira.codehaus.org/browse/MNG-5188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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
[jira] Commented: (MNG-5188) Test scope dependency incorrectly promoted to compile scope
[ https://jira.codehaus.org/browse/MNG-5188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=282866#comment-282866 ] Benjamin Bentmann commented on MNG-5188: Thanks for the example project. Workaround for now is to repeat the exclusion of junit in the dependency on module1:test-jar as well. 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