Apply exclusions to existing war entries

Update `RepackageMojo` and supporting classes so that `exclusions`
on the repackage goal apply to both the contributed libraries and any
existing jar entries already contained in the original war.

Prior to this commit, exclusions would apply to contributed jars (for
example, those in `WEB-INF/lib-provided`) but not jars that were
packaged directly into `WEB-INF/lib` by the war plugin

Fixes gh-15808

Co-authored-by: Phillip Webb <pwebb@vmware.com>
This commit is contained in:
Madhura Bhave
2021-06-08 17:23:04 -07:00
committed by Phillip Webb
parent 4d694ddaa8
commit b790c82732
17 changed files with 346 additions and 81 deletions

View File

@@ -198,7 +198,7 @@ abstract class ArchiveCommand extends OptionParsingCommand {
List<Library> libraries = new ArrayList<>();
for (URL dependency : dependencies) {
File file = new File(dependency.toURI());
libraries.add(new Library(file, getLibraryScope(file)));
libraries.add(new Library(null, file, getLibraryScope(file), null, false, false, true));
}
return libraries;
}
@@ -256,7 +256,7 @@ abstract class ArchiveCommand extends OptionParsingCommand {
List<Library> libraries = new ArrayList<>();
for (MatchedResource entry : entries) {
if (entry.isRoot()) {
libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE));
libraries.add(new Library(null, entry.getFile(), LibraryScope.COMPILE, null, false, false, true));
}
else {
writeClasspathEntry(writer, entry);