apache / apache/maven-war-plugin
[MWAR-443] Maven WAR plugin is deleting files generated by Maven Dependency plugin after upgrading to 3.3.1
- Dominant language
- Java
- Stars
- 50
- Forks
- 97
- Avg merge
- 16h 49m
- Merged PRs (30d)
- 3
Description
**[David Benes](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=benes)** opened **[MWAR-443](https://issues.apache.org/jira/browse/MWAR-443?redirect=false)** and commented
In my project, I'm using Derby database. Derby also needs locales, otherwise I get warning in the log file. Derby mentings these locales in manifest file without versions. So I ended up using something like following pom.xml (simplified)
```java
4.0.0
test
maven-war-issue
0.0.1
war
UTF-8
10.14.2.0
org.apache.derby
derby
${derby.version}
org.apache.derby
derbyLocale_cs
${derby.version}
provided
org.apache.maven.plugins
maven-compiler-plugin
3.8.1
1.8
1.8
org.apache.maven.plugins
maven-dependency-plugin
3.2.0
copy
prepare-package
copy-dependencies
derbyLocale_cs
${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib
false
false
true
true
org.apache.maven.plugins
maven-war-plugin
3.3.1
WebContent
false
```
After upgrading to Maven WAR plugin, this stopped working because after copying artifacts, by the Maven Dependency plugin to correct location they are deleted by Maven WAR plugin as shown in below:
```java
C:\code\maven-war-issue>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< test:maven-war-issue >------------------------
[INFO] Building maven-war-issue 0.0.1
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-war-issue ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\code\maven-war-issue\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ maven-war-issue ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-war-issue ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\code\maven-war-issue\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ maven-war-issue ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven-war-issue ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-dependency-plugin:3.2.0:copy-dependencies (copy) @ maven-war-issue ---
[INFO] Copying derbyLocale_cs-10.14.2.0.jar to C:\code\maven-war-issue\target\maven-war-issue-0.0.1\WEB-INF\lib\derbyLocale_cs.jar
[INFO]
[INFO] --- maven-war-plugin:3.3.1:war (default-war) @ maven-war-issue ---
[INFO] Packaging webapp
[INFO] Assembling webapp [maven-war-issue] in [C:\code\maven-war-issue\target\maven-war-issue-0.0.1]
[INFO] Processing war project
[INFO] deleting outdated resource WEB-INF\lib\derbyLocale_cs.jar
[INFO] Building war: C:\code\maven-war-issue\target\maven-war-issue-0.0.1.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.944 s
[INFO] Finished at: 2021-07-09T16:35:29+02:00
[INFO] ------------------------------------------------------------------------C:\code\maven-war-issue>
```
For me it seems to be the same as MWAR-433, but as that was already fixed in version 3.3.1, this seems to be another case.
Is there some way how I can mark those artifacts copied by Maven Dependency plugin as not outdated?
---
**Affects:** 3.3.1
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported project with `mvn package`, focusing on the Maven WAR plugin's webapp assembly and its handling of `WEB-INF/lib/derbyLocale_cs.jar` copied by the Maven Dependency plugin. Trace the packaging behavior around the logged deletion of the artifact; done means the copied dependency remains in the assembled webapp and WAR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100