Uploaded image for project: 'Maven Assembly Plugin'
  1. Maven Assembly Plugin
  2. MASSEMBLY-894

Test scope dependency causes compile time dependency to be excluded

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.1.0
    • None
    • dependencySet, filtering
    • None

    Description

      Consider the following dependencies

      • moduleA depends on moduleB, at compile scope, which in turn depends on libraryX, also at compile scope
      • moduleA also depends on libraryX directly, but at a test scope

      In this scenario, when defining a dependencySet to capture the runtime dependencies of moduleA, I would expect libraryX to be included, but it seems it's not.  That's because the test scope we use directly in moduleA is overriding the compile scope from moduleB.  I would think that the dependency should be included, as its a compile (and thus runtime) dependency of moduleB, and therefore of moduleA itself, even though it's not a compile time dependency of moduleA directly. Moreover, since the direct dependency from moduleA is at a test scope, it should be completely ignored by the plugin, which should be only looking at runtime scope.

      I have created a sample project to illustrate this behavior here.  If you run mvn clean package, the jackson-core jars (and others) do not end up in the final distribution.  I observed this behavior in version 2.6 of the plugin, but also tried with 3.1.0 and saw the same (although the debug output differed somewhat). If you change the scope on line 76 of the root pom.xml file to compile instead, then it works as expected.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jeff.w.evans Jeff Evans
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: