You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Andrei Tomashpolskiy (JIRA)" <ji...@apache.org> on 2017/04/29 12:46:04 UTC

[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&focusedCommentId=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 <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)