Issue Details (XML | Word | Printable)

Key: MNG-1378
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Mark Hobson
Votes: 24
Watchers: 26
Operations

If you were logged in you would be able to see more operations.
Maven 2 & 3

Make dependencies of test-jars transitive

Created: 31/Oct/05 03:54 AM   Updated: 16/Jan/09 07:48 AM
Component/s: Dependencies
Affects Version/s: 2.0
Fix Version/s: 3.x (to be reviewed)

Time Tracking:
Not Specified

File Attachments: 1. GZip Archive mng1378.tar.gz (2 kB)

Issue Links:
Duplicate
 
Related
dependent
 

Complexity: Intermediate


 Description  « Hide

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



Carlos Sanchez added a comment - 28/May/06 01:44 PM

Set a better title. The problem here is that by design test dependencies are not transitive


Kenney Westerhof added a comment - 08/Jun/07 02:19 PM

changed the title as 'Make test dependencies transitive' is incorrect. Test dependencies
are dependencies with scope test. test-jar dependencies are something totally different,
and they can have scope compile.


Lukas Theussl added a comment - 16/Jan/09 07:48 AM

Attaching a simple test project as I just came across this. It doesn't cover all possible manifestations but is the simplest self-contained example that I could come up with. Running test in impl fails, uncommenting the util dependency (non test-jar) in impl's pom makes it pass. In practice I guess this bug is often masked by the fact that you also have a dependency on the corresponding main jar anyway.