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

Inherit dependencies from a WAR type dependency.

    XMLWordPrintableJSON

    Details

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

      Description

      Given we have a Maven project, which produces a WAR overlay:

      <project>
        [...]
        <packaging>war</packaging>
        [...]
        <dependencies>
          <dependency>
            <groupId>com.example</groupId>
            <artifactId>my-base-war</artifactId>
            <type>war</type>
          </dependency>
        </dependencies>
        [...]
      </project>
      

      The dependency and dependency management declarations of com.example:my-base-war are not inherited by the overlay.

      The use-case is to create a WAR for Tomcat (as base war) and to enhance it with additional Jars for specific cloud providers like Azure and AWS via overlays.

      The missing inheritance of dependencies and dependency management results in:

      • maven-war-plugin fails with error "webxml attribute is required", because the servlet-api dependency is missing
        • Workaround: specify `failOnMissingWebXml = false` in maven-war-plugin
      • Dependency Jars being packaged multiple times in different versions although already provided by the base war
        • Workaround: Setting those dependencies to `provided` in the overlay.

      In my opinion the dependencies and dependency management of a WAR shall be taken into account by Maven in the same way as for Jars (i.e. fat-jars) to provide a coherent inheritance concept.

      Related Issues:

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                frederik.boster Frederik Boster
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: