[ 
https://issues.apache.org/jira/browse/MNG-5188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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]  
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
[DEBUG]  
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
[DEBUG]  
d:\maven_repo\.m2\repository\commons-pool\commons-pool\1.5.4\commons-pool-1.5.4.jar
[DEBUG]  
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] Source roots:
[DEBUG]  E:\tmp-help\junit-transitive\module2\src\main\java
[DEBUG] Command line options:
[DEBUG] -d E:\tmp-help\junit-transitive\module2\target\classes -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;
 -sourcepath E:\tmp-help\junit-transitive\module2\src\main\java; -g -nowarn 
-target 1.5 -source 1.5
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. 
build is platform dependent!
[DEBUG] incrementalBuildHelper#beforeRebuildExecution
[INFO] Compiling 1 source file to 
E:\tmp-help\junit-transitive\module2\target\classes
[DEBUG] incrementalBuildHelper#afterRebuildExecution
{noformat}

> 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 
> <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.3.15#6346)

Reply via email to