[MNG-6699] Inherit dependencies from a WAR type dependency.
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Frederik Boster](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=frederik.boster)** opened **[MNG-6699](https://issues.apache.org/jira/browse/MNG-6699?redirect=false)** and commented
Given we have a Maven project, which produces a WAR overlay:
```java
[...]
war
[...]
com.example
my-base-war
war
[...]
```
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
---
**Issue Links:**
- [MNG-1991](https://issues.apache.org/jira/browse/MNG-1991) Can't get transitive dependencies from a war pom when this war is added as a depdency of a project
- [MNG-6162](https://issues.apache.org/jira/browse/MNG-6162) Maven dependency:tree doesn't show transitive dependencies of \war\ dependency
- [MWAR-253](https://issues.apache.org/jira/browse/MWAR-253) Inherit dependencies from a WAR type dependency when it is overlayed.
Contributor guide
Research direction
Start by reviewing Maven core's dependency resolution behavior for WAR-type dependencies, then compare the related issues MNG-1991, MNG-6162, and MWAR-253. Use the maven-war-plugin failure and duplicate dependency scenarios as checks; the work is done when a WAR overlay accounts for the base WAR's dependencies and dependency management without those workarounds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100