Affects Version/s: plexus-archiver-1.2, plexus-archiver-2.0
Fix Version/s: plexus-archiver-2.0.2
Maven WAR Plugin
Plexus Archiver 1.2 (with local modifications, see below)
Number of attachments :
I'm trying to fix
MWAR-248 and have found the problem, after some serious digging into the plexus-archiver code.
The WAR Plugin begins by creating a WarArchiver to which it adds the webapp directory, using warArchiver.addDirectory(...). This adds the files in the webapp directory as a PlexusIoFileResourceCollection. Each object in the collection is added to the archive as an ArchiveEntry with a target name that is platform dependent. On Windows the contents of the archive looks like this, when printing out each entry's name:
When this is done the WAR Plugin tried to add the web.xml file, if one exists. This is added to the WarArchive as a file.
WarArchiver.setWebxml() (line 88) will add the file with the target name hard coded to "WEB-INF/web.xml". This results in an ArchiveEntry that is different from the one added in the earlier step, for the exact same file.
Proposed Solution 1
Replace the hard coded file separator with File.separatorChar.
AbstractArchiver.addFile() (line 362) replaces all '\' with '/' in the target name. Again this results in an ArchiveEntry that is different than in the earlier step.
Remove the line that converts '\' to '/':
The first solution is a no brainer, but I'm not sure what impact the second one will have. Ideally it would be best to always use Java syntax paths, with '/'. But I haven't figured out how to do this for warArchiver.addDirectory(...).
I've tried my proposed solution locally on Windows and all tests pass both in plexus archiver and the WAR Plugin. If you approve my proposed solution, I'll conduct more tests, and provide a patch file.
All testing and modifications have been done on the plexus-archiver-1.2 tag. I haven't yet tried to upgrading the WAR Plugin to use Plexus Archiver 2.0.1.