You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Paul Benedict (JIRA)" <ji...@codehaus.org> on 2014/07/02 15:44:55 UTC

[jira] (MNG-3044) A dependency on a test-jar should bring in the main artifact as a dependency

     [ https://jira.codehaus.org/browse/MNG-3044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated MNG-3044:
-------------------------------

    Fix Version/s:     (was: Issues to be reviewed for 3.x)

> A dependency on a test-jar should bring in the main artifact as a dependency
> ----------------------------------------------------------------------------
>
>                 Key: MNG-3044
>                 URL: https://jira.codehaus.org/browse/MNG-3044
>             Project: Maven
>          Issue Type: Bug
>          Components: Dependencies
>            Reporter: Kenney Westerhof
>
> Note that this issue is NOT a duplicate of MNG-1378 ea.
> Since test-classes (src/test/java) have src/main/java in the classpath while compiling, and often use code from it,
> the main classes should be included in the classpath if there's a dependency on the test jar.
> Consider:
> Project A has src/main/java/Main.java and src/test/java/Test.java, where Test.java uses Main.java.
> Project A is packaged as a normal jar and has an attached test-jar.
> Project B depends on A's test-jar, because it wants to use Test.java (Test.class).
> This fails because of a NoClassDefFound on Main.class: B's compiletime classpath contains B's sources and the test-jar. It should also contain
> A's main artifact.
> Test-jars have a compile-time (and runtime) dependency on the main classes; maven should bring in the main artifact aswell.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)