Maven
  1. Maven
  2. MNG-1378

Make dependencies of test-jars transitive

    Details

      Description

      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

      1. mng1378.tar.gz
        2 kB
        Lukas JOSEFIK

        Issue Links

          Activity

          Mark Hobson created issue -
          Brett Porter made changes -
          Field Original Value New Value
          Description 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
          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
          Environment
          Fix Version/s 2.1 [ 11704 ]
          Joakim Erdfelt made changes -
          Link This issue is related to MNG-1971 [ MNG-1971 ]
          Joakim Erdfelt made changes -
          Link This issue is related to MNG-1571 [ MNG-1571 ]
          Vincent Massol made changes -
          Workflow Maven [ 41228 ] Maven New [ 48250 ]
          Brett Porter made changes -
          Link This issue is duplicated by MNG-2035 [ MNG-2035 ]
          Jorg Heymans made changes -
          Link This issue is depended upon by MNG-1823 [ MNG-1823 ]
          Carlos Sanchez made changes -
          Summary test-jar transitive dependencies are incorrectly calculated Make test dependencies transitive
          Carlos Sanchez made changes -
          Component/s Dependencies [ 12028 ]
          Component/s Plugins and Lifecycle [ 11340 ]
          Carlos Sanchez made changes -
          Link This issue is duplicated by MNG-1921 [ MNG-1921 ]
          Jason van Zyl made changes -
          Fix Version/s 2.1 [ 11704 ]
          Fix Version/s 2.1.x [ 13142 ]
          kenneyw made changes -
          Summary Make test dependencies transitive Make dependencies of test-jars transitive
          Jason van Zyl made changes -
          Fix Version/s 3.x [ 13145 ]
          Fix Version/s 3.0 [ 13142 ]
          Lukas Theussl made changes -
          Attachment mng1378.tar.gz [ 39369 ]
          Olivier Lamy (*$^¨%`£) made changes -
          Comment [ To Voters and Watchers:
          I registered this issue in the "kickstarting" section on FreedomSponsors. This means that if you need this issue that bad, you can go to http://www.freedomsponsors.org/core/issue/53/make-dependencies-of-test-jars-transitive and offer a few bucks for it.
          (Learn more --> http://blog.freedomsponsors.org/about/) ]
          Robert Scholte made changes -
          Link This issue is duplicated by MNG-5621 [ MNG-5621 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
          Mark Thomas made changes -
          Workflow jira [ 12712382 ] Default workflow, editable Closed status [ 12752249 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
          Mark Thomas made changes -
          Workflow jira [ 12952470 ] Default workflow, editable Closed status [ 12989819 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Mark Hobson
            • Votes:
              59 Vote for this issue
              Watchers:
              62 Start watching this issue

              Dates

              • Created:
                Updated:

                Development