[ 
https://issues.apache.org/jira/browse/MNG-6699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16983987#comment-16983987
 ] 

Frederik Boster edited comment on MNG-6699 at 11/27/19 10:49 PM:
-----------------------------------------------------------------

While that is true for a Jar project context it is not in a WAR file context.

WAR overlays are a very valid use-case in my opinion to support dependency 
resolution in case a WAR references another WAR to create an overlay.

Additionally a WAR can be referenced by another WAR at runtime according to the 
JavaEE spec.

It should be the responsibility of the maven-war-plugin to correctly set 
bundled jars as "provided" in the deployable POM and the responsibility of 
Maven to support resolution of declared dependencies in the POM according to 
the same rules as for Jars.

If fat-jars are supported in this way why are WARs not? They are semantically 
the same.


was (Author: frederik.boster):
While that is true for a Jar project context it is not in a WAR file context.

WAR overlays are a very valid use-case in my opinion to support dependency 
resolution in case a WAR references another WAR to create an overlay.

Additionally a WAR can be referenced by another WAR at runtime according to the 
JavaEE spec.

It should be the responsibility of the maven-war-plugin to correctly set 
bundled jars as "provided" in the deployable POM and the responsibility of 
Maven to support resolution of declared dependencies in the POM according to 
the same rules as for Jars.

> 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)

Reply via email to