开发者

Checking for corrupt war file after mvn install

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 va开发者_StackOverflowlidate the file as soon as mvn install is completed. Is there a maven command to do this? Any other ideas?


Your corruption could be due to PLXCOMP-149. If you supress the included version of plexus-io that comes with the war plugin and replace it with the newly released 1.0, your problems just might go away.

I know I'm not answering your question, but I might solve your problem. Add a dependency to

<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-io</artifactId>
<version>1.0</version>

To your war plugin's plugin section.


You can use the dependency plugin for this. I'd consider implementing an integration test (start war in a servlet container and do a some smoke test) as well.


You could attempt to add a step which invokes the antrun plugin to do an <unzip> of the output WAR to a temporary file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜