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

Plugin omits transitive runtime dependencies where artifact is present with test-scope in current project

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.1
    • 2.5.1
    • None
    • None
    • Linux, Sun 64-bit JDK 1.6.24

    Description

      Let's say I have Project1, which has a runtime dependency on an artifact, e.g. Log4j, and Project2 which is defined to have a runtime dependency on Project1. Project2 defines a dependency on Log4j with test-scope.

        P1 --runtime--> P2 --runtime--> Log4j
        |
       test
        |
        V
       Log4j
      

      If I define a descriptor in Project2 to include runtime dependencies, the Log4j artifact is not included in the resulting ZIP unless it is removed from Project2's dependencies first.

      This can be replicated through the use of the attached map-jira-1.zip files.
      1) Unzip to the filesystem
      2) Execute mvn package from the maven-assembly-jira1 directory
      3) Inspect the contents of the ZIP in project2/target (on nix: unzip -l project2/target/.zip). Note the absence of Log4j.
      4) Edit project2/pom.xml to comment-out the dependency on Log4j.
      5) Execute mvn package from the maven-assembly-jira1 directory
      6) Inspect the contents of the ZIP in project2/target. Note the inclusion of Log4j.

      This may not be entirely surprising to this plugin's developers. This is a specific issue for us since several projects define APIs and separate implementations. We depend on the API at compile-time and for testing use some implementation thereof. For example, we depend on SLF4j API and leave definition of the runtime logging implementation to some runtime, base-project (in this example, Project1). For testing purposes we need to define an SLF4j implementation, which just so happens (fancy that) to be the one we use in production. Our resulting deployable is created without the correct dependency set.

      I would have expected to receive all the runtime, transitive dependencies of my dependencies whether or not I declare a test dependency on those artifacts.

      Attachments

        1. map-jira-1.zip
          2 kB
          Michael

        Issue Links

          Activity

            People

              krosenvold Kristian Rosenvold
              michaelg Michael
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: