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

war manifest generation : optional=true not transitive

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      From http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html, war plugins distinguished the jars going to ear file and those going to WEB-INF/lib.

      For a jar that's deployed on the ear and not in WEB-INF/ilb, you jus have to put scope=compile and optional=true:
      <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar1</artifactId>
      <version>$

      {pom.version}

      </version>
      <optional>true</optional>
      <!-- goes in manifest classpath, but not included in WEB-INF/lib -->
      </dependency>

      The problem is transitive dependencies of bar-jar1 are put in WEB-INF/lib.

      For instance :
      if artA declares
      <dependency>
      <artifactId>artB</artifactId>
      <optional>true</optional>
      </dependency>
      and artB declares :
      <dependency>
      <artifactId>artC</artifactId>
      <optional>false</optional>
      </dependency>
      then artC is transitively included in artA dependencies but with optional=false.

      IMHO it should be included with optional=true since artB is optional.

      I'll attach a test case ASAP.

        Issue Links

          Activity

          Hide
          Adrian added a comment -

          Here's a test case :

          test-project
          <parent project>
          test-ear
          <ear file including test-web web module, test-service jar utility and test-service jars dependencies>
          test-service
          <utility jar bundled in ear file (not in WEB-INF/lib>
          test-web
          <the interesting module>

          test-web declares a dependency towards test-service with scope=compile and optional=true.
          test-web declares a dependency towards commons-logging with scope=compile and optional=false.
          test-web declares a dependency towards spring with scope=compile and optional=false.

          When executing 'mvn package', we see that spring jar is bundled in WEB-INF/lib.
          Since it's include from a transitive optional dependency (test-service) we should expect it not to be bundled in WEB-INF/lib.

          Show
          Adrian added a comment - Here's a test case : test-project <parent project> test-ear <ear file including test-web web module, test-service jar utility and test-service jars dependencies> test-service <utility jar bundled in ear file (not in WEB-INF/lib> test-web <the interesting module> test-web declares a dependency towards test-service with scope=compile and optional=true. test-web declares a dependency towards commons-logging with scope=compile and optional=false. test-web declares a dependency towards spring with scope=compile and optional=false. When executing 'mvn package', we see that spring jar is bundled in WEB-INF/lib. Since it's include from a transitive optional dependency (test-service) we should expect it not to be bundled in WEB-INF/lib.
          Adrian made changes -
          Field Original Value New Value
          Attachment test.zip [ 29927 ]
          Adrian made changes -
          Link This issue duplicates MWAR-111 [ MWAR-111 ]
          Hide
          Adrian added a comment -

          Sorry, duplicate issue

          Show
          Adrian added a comment - Sorry, duplicate issue
          Stéphane Nicoll made changes -
          Link This issue is duplicated by MWAR-111 [ MWAR-111 ]
          Hide
          Stéphane Nicoll added a comment -

          Indeed see duplicate link

          Show
          Stéphane Nicoll added a comment - Indeed see duplicate link
          Stéphane Nicoll made changes -
          Resolution Duplicate [ 3 ]
          Status Open [ 1 ] Closed [ 6 ]
          Stéphane Nicoll made changes -
          Assignee Stephane Nicoll [ sni ]
          Stéphane Nicoll made changes -
          Link This issue duplicates MWAR-111 [ MWAR-111 ]
          Dennis Lundberg made changes -
          Link This issue duplicates MWAR-111 [ MWAR-111 ]
          Dennis Lundberg made changes -
          Link This issue is duplicated by MWAR-111 [ MWAR-111 ]

            People

            • Assignee:
              Stéphane Nicoll
              Reporter:
              Adrian
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: