[ 
https://jira.codehaus.org/browse/MNG-1378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=349599#comment-349599
 ] 

Didier Loiseau commented on MNG-1378:
-------------------------------------

Then I guess dependencies on test-jars should be completely disallowed. If your 
tests depend on some test-jar, and you don't have the dependencies of that 
test-jar, it is well possible that your tests cannot compile at all!

It is not just a question of extending test cases, it could also be a question 
of reusing some other classes of the test-jar.

For example, suppose you have module X and module Y which depends on X. In the 
test classes of module X, you implement a {{TestUtil}} class which relies on 
some other class of X's main classpath and on some class from a test-scoped 
dependency. Of course, the tests of X depend on {{TestUtil}}.

Now, in the tests of module Y, you would like to reuse {{TestUtil}}. You thus 
need to declare a test-scoped dependency on X's test-jar. But for the moment 
you also have to redeclare all the test-scoped dependencies of X in order to 
use that class. And you cannot move that class somewhere else, due to its 
dependencies.

> Make dependencies of test-jars transitive
> -----------------------------------------
>
>                 Key: MNG-1378
>                 URL: https://jira.codehaus.org/browse/MNG-1378
>             Project: Maven
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 2.0
>            Reporter: Mark Hobson
>             Fix For: Issues to be reviewed for 3.x
>
>         Attachments: mng1378.tar.gz
>
>
> test-jar transitive dependencies are calculated as per compile scope rather 
> than test scope.
> The situation is demonstrated nicely in it0077:
> * module sub1 has a test-scoped dependency of commons-lang
> * module sub2 has a test-scoped dependency of sub1 test-jar
> sub2 tests should inherit the commons-lang transitive dependency.  For 
> example:
> Index: 
> maven-core-it/it0077/sub2/src/test/java/org/apache/maven/it0077/PersonTwoTest.java
> ===================================================================
> --- 
> maven-core-it/it0077/sub2/src/test/java/org/apache/maven/it0077/PersonTwoTest.java
>   (revision
> 328307)
> +++ 
> maven-core-it/it0077/sub2/src/test/java/org/apache/maven/it0077/PersonTwoTest.java
>   (working
> copy)
> @@ -1,6 +1,7 @@
>  package org.apache.maven.it0077;
>  import junit.framework.TestCase;
> +import org.apache.commons.lang.BooleanUtils;
>  public class PersonTwoTest
>     extends PersonTest
> Results in:
> [INFO] 
> ----------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] 
> ----------------------------------------------------------------------------
> [INFO] Compilation failure
> c:\maven-components\maven-core-it\it0077\sub2\src\test\java\org\apache\maven\it0077\PersonTwoTest.java:[4,31]
> package org.apache.commons.lang does not exist



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

Reply via email to