Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-1571

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 2.0.4
    • Plugins and Lifecycle
    • None

    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.

      Attachments

        Issue Links

          Activity

            People

              carlos Carlos Sanchez Gonzalez
              joehni Joerg Schaible
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: