Maven WAR Plugin
  1. Maven WAR Plugin
  2. MWAR-111

Transitive dependencies of optional dependencies are included in WEB-INF/lib

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.2
    • Fix Version/s: waiting-for-feedback
    • Component/s: None
    • Labels:
      None
    • Environment:
      Maven 2.0.7, JDK 1.6.0_01-b06, JavaEE 5

      Description

      I have an EAR project (TestEAR) which contains two modules:

      1. A JAR module (TestJAR) which has one dependency: commons-lang 2.3
      2. A WAR module (TestWAR) which uses these instructions to declare a dependency on TestJAR so that TestJAR is included in TestWAR's manifest classpath, but not copied into WEB-INF/lib (i.e. declares the dependency optional).

      This works fine for TestJAR itself, but its transitive dependency (commons-lang 2.3) is still copied into WEB-INF/lib. I don't believe this is the correct behavior since all dependencies of a JAR packaged in the EAR must also be packaged in the EAR. So, all a WAR should have to do is put the transitive dependencies in its manifest classpath to inherit them. Basically: in a WAR, transitive dependencies of "optional" dependencies should inherit the "optional" flag.

      I have included a simple test project as an example. Unzip, cd TestProject, and mvn install. Look in TestEAR's target dir and you will see that commons-lang is included in the EAR. Then look in TestWAR's target dir and you will see that commons-lang is also included in both the manifest classpath and the WEB-INF/lib dir.

      1. AbstractWarMojo.java
        38 kB
        Chris Lance
      2. MWAR-111.patch
        3 kB
        Keith Naas
      3. TestProject.zip
        5 kB
        Chris Lance

        Issue Links

          Activity

          Chris Lance created issue -
          Chris Lance made changes -
          Field Original Value New Value
          Attachment AbstractWarMojo.java [ 28753 ]
          gonzalad made changes -
          Link This issue is duplicated by MWAR-125 [ MWAR-125 ]
          Stephane Nicoll made changes -
          Link This issue duplicates MWAR-125 [ MWAR-125 ]
          Stephane Nicoll made changes -
          Link This issue is duplicated by MWAR-125 [ MWAR-125 ]
          Stephane Nicoll made changes -
          Link This issue relates to MWAR-83 [ MWAR-83 ]
          Keith Naas made changes -
          Attachment MWAR-111.patch [ 31227 ]
          Keith Naas made changes -
          Link This issue is depended upon by MECLIPSE-360 [ MECLIPSE-360 ]
          Dennis Lundberg made changes -
          Link This issue is duplicated by MWAR-125 [ MWAR-125 ]
          Dennis Lundberg made changes -
          Link This issue duplicates MWAR-125 [ MWAR-125 ]
          Roman Arkadijovych Muntyanu made changes -
          Link This issue is related to MNG-5255 [ MNG-5255 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:28:45 UTC 2015 [ 1428240525159 ]
          Mark Thomas made changes -
          Workflow jira [ 12728527 ] Default workflow, editable Closed status [ 12764748 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 01:49:55 UTC 2015 [ 1428284995525 ]
          Mark Thomas made changes -
          Workflow jira [ 12966339 ] Default workflow, editable Closed status [ 13002358 ]
          Karl Heinz Marbaise made changes -
          Fix Version/s waiting-for-feedback [ 12331761 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Chris Lance
            • Votes:
              22 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

              • Created:
                Updated:

                Development