[
https://issues.apache.org/jira/browse/MNG-6699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16985425#comment-16985425
]
Karl Heinz Marbaise commented on MNG-6699:
------------------------------------------
* The [documentation of the
maven-war-plugin|https://maven.apache.org/plugins/maven-war-plugin/] states for
overlays:
"To share common resources across multiple web applications, see the
documentation about using overlays."
* Your point about referencing another WAR based on JavaEE spec is correct but
exactly as you stated: *at runtime*. Here we are talking about build time.
Let us think a little bit about your ideas:
* maven-war-plugin would set all bundled jars to *provided* (Apart from the
capability to change the pom). That means first we have to populate that new
pom somehow into the reactor of Maven which results in changes of the
dependency which results into another resolution cycle. And that for each war
module.
* What about the transitive dependencies of all those jar's which have been
inside the war ?
* Based on the previous this would result in a very large change which will
not happen before Maven 4.X (if it will happen at all)
One very important point is that a war can neither being used on the classpath
nor on the module path.
> Inherit dependencies from a WAR type dependency.
> ------------------------------------------------
>
> Key: MNG-6699
> URL: https://issues.apache.org/jira/browse/MNG-6699
> Project: Maven
> Issue Type: Improvement
> Components: Dependencies
> Reporter: Frederik Boster
> Priority: Major
>
> Given we have a Maven project, which produces a WAR overlay:
> {code:java}
> <project>
> [...]
> <packaging>war</packaging>
> [...]
> <dependencies>
> <dependency>
> <groupId>com.example</groupId>
> <artifactId>my-base-war</artifactId>
> <type>war</type>
> </dependency>
> </dependencies>
> [...]
> </project>
> {code}
> 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:
> * MWAR-253
> * MNG-1991
> * MNG-6162
--
This message was sent by Atlassian Jira
(v8.3.4#803005)