Checking for corrupt war file after mvn install
Posted
by Tauren
on Stack Overflow
See other posts from Stack Overflow
or by Tauren
Published on 2010-04-23T20:58:08Z
Indexed on
2010/04/23
21:03 UTC
Read the original article
Hit count: 500
Is there a maven command that will verify that a WAR file is valid and not corrupt? Or is there some other program or technique to validate zip files? I'm on Ubuntu 9.10, so a linux solution is preferred.
On occasion, I end up with a corrupt WAR file after doing mvn clean
and mvn install
on my project. If I extract the WAR file to my hard drive, an error occurs and the file doesn't get extracted. I believe this happens when my system is in a low-memory condition, because this tends to happen only when lots of memory is in use. After rebooting, doing a mvn install
always gives a valid WAR file.
Because this happens infrequently, I don't typically test the file by uncompressing it. I transfer the 50MB war file to my server and then restart Jetty with it as the root webapp. But when the file is corrupt, I get a java.util.zip.ZipException: invalid block type
error.
So I'm looking for a quick way to validate the file as soon as mvn install is completed. Is there a maven command to do this? Any other ideas?
© Stack Overflow or respective owner