Ant <war> & <jar> tasks and WinZIP

0

Yesterday I ran into some freaky behavior while building a web-application for Tomcat using Ant. In my build script I use the war task.
I used WinZIP to check if all files I needed were present in the war file.
When I deployed the war file I created on Tomcat, I got an error indicating that the web.xml file could not be located. In the war file it was present however. Closer inspection revealed that it was located in a directory web-inf (lower-case) in the war file, whilst on the filesystem the directory from which it was build is in uppercase as it should be.

I turned out that opening the war file with WinZIP is the culprit.

Form the ant FAQ on the apache site

You may have seen these lower-case directory names in WinZIP, but WinZIP is trying to be helpful (and fails). If WinZIP encounters a filename that is all upper-case, it assumes it has come from an old DOS box and changes the case to all lower-case for you.

If you extract (or just check) the archive with jar, you will see that the names have the correct case.

With WinZIP (version 8.1 at least), this can be corrected in the configuration. In the Options/Configuration menu, in the View tab, General section, check the “Allow all upper case files names” box. The META-INF and WEB-INF will look correct.

Easily done …

Tomcat happy, me happy

Share.

About Author

Comments are closed.