in src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java [281:312]
public void copyResources(WarPackagingContext context, Resource resource)
throws IOException, MojoExecutionException {
if (!context.getWebappDirectory().exists()) {
context.getLog()
.warn("Not copying webapp webResources [" + resource.getDirectory()
+ "]: webapp directory ["
+ context.getWebappDirectory().getAbsolutePath()
+ "] does not exist!");
}
context.getLog()
.info("Copying webapp webResources [" + resource.getDirectory() + "] to ["
+ context.getWebappDirectory().getAbsolutePath() + "]");
String[] fileNames = getFilesToCopy(resource);
for (String fileName : fileNames) {
String targetFileName = fileName;
if (resource.getTargetPath() != null) {
// TODO make sure this thing is 100% safe
// MWAR-129 if targetPath is only a dot <targetPath>.</targetPath> or ./
// and the Resource is in a part of the warSourceDirectory the file from sources will override this
// that's we don't have to add the targetPath yep not nice but works
if (!Objects.equals(".", resource.getTargetPath()) && !Objects.equals("./", resource.getTargetPath())) {
targetFileName = resource.getTargetPath() + File.separator + targetFileName;
}
}
if (resource.isFiltering() && !context.isNonFilteredExtension(fileName)) {
copyFilteredFile(id, context, new File(resource.getDirectory(), fileName), targetFileName);
} else {
copyFile(id, context, new File(resource.getDirectory(), fileName), targetFileName);
}
}
}