Maven 2 & 3

Include/Exclude of transitive dependencies depends on alphabetic order of module names.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.8
  • Fix Version/s: 2.0.9
  • Component/s: Dependencies
  • Labels:
    None
  • Environment:
    $ mvn -v
    Maven version: 2.0.8-el4j-20071205
    Java version: 1.5.0_15
    OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
  • Complexity:
    Intermediate
  • Number of attachments :
    1

Description

Consider five projects A, B, C, D, E with dependencies (--> = depends-on)

A --> B, C
B --> D excluding E
C --> D
D --> E

In this scenario, as B comes before C alphabetically, dependency D of A is processed as in B and E is not included as a transitive dependency of A.
Removing the exclusion in B and putting it in C makes E appear.

To recreate the bug:
I have attached a small demo zip; after building all five projects run "mvn exec:java -Dexec.mainClass=test.A" in /A. Note that E is not included in the classpath.

(I got this result:
file:/d:/Projects/maven-test/A/target/classes/
file:/d:/Projects/maven-test/A/target/test-classes
file:/d:/m2repository/test/B/1.0-SNAPSHOT/X-1.0-SNAPSHOT.jar
file:/d:/m2repository/test/D/1.0-SNAPSHOT/D-1.0-SNAPSHOT.jar
file:/d:/m2repository/test/C/1.0-SNAPSHOT/C-1.0-SNAPSHOT.jar )

Remove the exclusion of E in B's pom and put it in C's in the same place. Then remake all projects - E is now included
(Sample oputput:
file:/d:/Projects/maven-test/A/target/classes/
file:/d:/Projects/maven-test/A/target/test-classes
file:/d:/m2repository/test/B/1.0-SNAPSHOT/B-1.0-SNAPSHOT.jar
file:/d:/m2repository/test/D/1.0-SNAPSHOT/D-1.0-SNAPSHOT.jar
file:/d:/m2repository/test/E/1.0-SNAPSHOT/E-1.0-SNAPSHOT.jar
file:/d:/m2repository/test/C/1.0-SNAPSHOT/C-1.0-SNAPSHOT.jar)

Activity

Hide
David Bernhard added a comment -

This seems to be fixed in 2.0.9. It works again as specified in http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html : The first dependency wins.

Show
David Bernhard added a comment - This seems to be fixed in 2.0.9. It works again as specified in http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html : The first dependency wins.
Hide
David Bernhard added a comment -

Fixed in 2.0.9 (documented in release notes).

Show
David Bernhard added a comment - Fixed in 2.0.9 (documented in release notes).

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: