I have built an executable .war with an embedded Jetty and all the dependencies packed in using the Maven Shade and War plugins. When I tried to run it (
java -jar <my war>.war) then I got a strange
FileNotFoundException during the unpack phase. It was strange because the unpack code actually checks whether a file’s parent directory exists and creates it if it doesn’t.
The problem was that I use OS X which has a case-insensitive filesystem. A directory contained both the file LICENSE and the directory license/. When Jetty tried to unpack license/LICENSE.base64.txt, the check for the parent directory (license/) incorrectly succeeded (because it checked n
ew File("[..]/license/LICENSE.base64.txt").getParentFile().exists() and that returned true because the file LICENSE already was there, and it wasn’t distinguished from the actual directory license;
.isDirectory() would have at least failed.) The workaround was to exclude the offensive file from the archive: