Maven 2 & 3
  1. Maven 2 & 3
  2. MNG-5096

<exclusion> on <dependency> with <type>test-jar</type> doesn't work in maven 3

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.3
    • Fix Version/s: 3.0.4
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 10.04
    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      There appears to be a regression in maven 3 that breaks test-jar dependency exclusions. I've attached a simple example to reproduce this. There are two projects: foo and bar. Project foo produces a test-jar artifact. Project bar depends on foo's test-jar but excludes a dependency on junit. In maven 2, a dependency:list shows that junit has successfully been excluded. In maven 3, a dependency:list shows that junit was not successfully excluded.

      To reproduce, download the maven-testcase.tar.gz attachment and run:

      $ tar xzvf maven-testcase.tar.gz
      $ cd maven-testcase/foo
      $ mvn2 install
      $ cd ../bar
      $ mvn2 dependency:list
      ...
      [INFO] The following files have been resolved:
      [INFO]    org.apache.maven:foo:test-jar:tests:1.0:test
      ...
      $ mvn3 dependency:list
      ...
      [INFO] The following files have been resolved:
      [INFO]    junit:junit:jar:4.8.1:test
      [INFO]    org.apache.maven:foo:test-jar:tests:1.0:test
      ...
      

        Activity

        Hide
        Martin Grotzke added a comment - - edited

        I'm also running into the same issue. But to me it seems that dependency:list and the actual test classpath are different for previous maven versions (e.g. 2.1.0): test test classpath still contains the unwanted dependencies even if dependency:list doesn't show them.

        Is there any progress on this btw?

        Show
        Martin Grotzke added a comment - - edited I'm also running into the same issue. But to me it seems that dependency:list and the actual test classpath are different for previous maven versions (e.g. 2.1.0): test test classpath still contains the unwanted dependencies even if dependency:list doesn't show them. Is there any progress on this btw?
        Hide
        Martin Grotzke added a comment -

        I just found out that with maven 3 (tested with 3.0.2) changing <type>test-jar</type> to <classifier>tests</classifier> solves this issue. With maven 2 (tested with 2.2.1) the situation is still the same.

        Show
        Martin Grotzke added a comment - I just found out that with maven 3 (tested with 3.0.2) changing <type>test-jar</type> to <classifier>tests</classifier> solves this issue. With maven 2 (tested with 2.2.1) the situation is still the same.
        Hide
        Benjamin Bentmann added a comment -

        Fixed in r1151423.

        Show
        Benjamin Bentmann added a comment - Fixed in r1151423 .

          People

          • Assignee:
            Benjamin Bentmann
            Reporter:
            Garrett Wu
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: