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

Dependency version from test scope leaks into compile scope

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3.9
    • Fix Version/s: None
    • Component/s: Dependencies
    • Labels:
      None

      Description

      Despite test scope being non-transitive [1] it's still used to resolve versions of compile dependencies. This might be causing issues in IDEs that rely on the Dependency plugin to assemble the application's classpath.

      E.g. for the following project configuration javax.servlet-api version is resolved to 3.0.1 (using nearest-first strategy to resolve conflicts):

      project1
      |-- project2:compile
      |..|-- jetty-server:compile
      |....|-- javax.servlet-api:3.1.0:compile
      |-- jersey-test-framework-core:test
      |..|-- javax.servlet-api:3.0.1:compile
      

      My understanding is that it should rather be resolved to 3.1.0, because version 3.0.1 stems from the test scope and should be ignored (AFAIK Maven Shade plugin works in that way).

      Please see a runnable code example in https://github.com/atomashpolskiy/maven-transitive-test-dependencies

      Thank you!

      [1] http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

        Attachments

        1. mvn_package.txt
          69 kB
          Andrei Tomashpolskiy

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                atomashpolskiy Andrei Tomashpolskiy
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: