Maven 2 & 3

Wrong calculation of transient dependecies if artifact is referenced from different scopes

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: None
  • Fix Version/s: 2.0.4
  • Component/s: Plugins and Lifecycle
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

I have an artifact A (elsag-test below), that is used by other projects only for the tests. A has a dependency to commons-logging. Artifact B has a compile-time dependency to an artifact, that also has a dependency on commons-logging. Nevertheless, the resulting scope for commons-logging is wrongly calculated as test and the compilation fails.

============= %< ================
[DEBUG] Retrieving parent-POM from the repository for project: com.elsagsolutions.commons:super-project:pom:1.1-SNAPSHOT
[DEBUG] meta: using locally installed snapshot
[DEBUG] com.elsagsolutions.commons:elsag-test:jar:1.2-SNAPSHOT (selected for test)
[DEBUG] cglib:cglib-nodep:jar:2.1_3 (selected for test)
[DEBUG] commons-logging:commons-logging:jar:1.0.4 (selected for test)
[DEBUG] jmock:jmock-cglib:jar:1.0.1 (selected for test)
[DEBUG] jmock:jmock:jar:1.0.1 (selected for test)
[DEBUG] junit:junit:jar:3.8.1 (selected for test)
[DEBUG] commons-httpclient:commons-httpclient:jar:2.0.2 (selected for compile)
[DEBUG] commons-logging:commons-logging:jar:1.0.4 (setting scope to: compile)
[DEBUG] commons-logging:commons-logging:jar:1.0.3 (removed - nearer found: 1.0.4)
[DEBUG] commons-logging:commons-logging:jar:1.0.3 (selected for compile)
[DEBUG] commons-io:commons-io:jar:1.0 (selected for compile)
[DEBUG] junit:junit:jar:3.8.1 (selected for compile)
============= %< ================
[INFO] ----------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ----------------------------------------------------------------------------
[INFO] Compilation failure

C:\Work\Projects\commons\lang\src\java\com\elsagsolutions\lang\net\AbstractSocketStreamServer.java:[14,34] package org.apache.commons.logging does not exist
============= %< ================

If I add commons-logging as direct dependency of B it works:

============= %< ================
[DEBUG] Retrieving parent-POM from the repository for project: com.elsagsolutions.commons:super-project:pom:1.1-SNAPSHOT
[DEBUG] meta: using locally installed snapshot
[DEBUG] com.elsagsolutions.commons:elsag-test:jar:1.2-SNAPSHOT (selected for test)
[DEBUG] cglib:cglib-nodep:jar:2.1_3 (selected for test)
[DEBUG] commons-logging:commons-logging:jar:1.0.4 (selected for test)
[DEBUG] jmock:jmock-cglib:jar:1.0.1 (selected for test)
[DEBUG] jmock:jmock:jar:1.0.1 (selected for test)
[DEBUG] junit:junit:jar:3.8.1 (selected for test)
[DEBUG] commons-logging:commons-logging:jar:1.0.4 (selected for compile)
[DEBUG] commons-httpclient:commons-httpclient:jar:2.0.2 (selected for compile)
[DEBUG] commons-logging:commons-logging:jar:1.0.3 (removed - nearer found: 1.0.4)
[DEBUG] commons-logging:commons-logging:jar:1.0.3 (selected for compile)
============= %< ================

Unfortunately this introduces a dependency for commons-logging, therefore I wanted to set the dep at least optional, but then commons-logging is again not available at compile time. Might be related to MNG-1378.

Issue Links

Activity

Hide
Brett Porter added a comment -

could be a duplicate

Show
Brett Porter added a comment - could be a duplicate
Hide
Joerg Schaible added a comment -

Was fixed in 2.0.4

Show
Joerg Schaible added a comment - Was fixed in 2.0.4

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: