Ant Unzip Issues

Let’s say I had a simple ant script which looked a little something like this:

<project name=”unzipstuff” default=”unzip”>
<target name=”unzip”>
<unzip src=”/home/webapps/edwinstarr.war” dest=”/home/webapps/edwin/starr/” >
</unzip>
</target>
</project>

Why oh why oh why oh why (etc and so on) would it fail with the following error?

BUILD FAILED
java.lang.RuntimeException: data starting at 0 is in unknown format
at org.apache.tools.zip.ZipEntry.setExtra(ZipEntry.java:272)
at org.apache.tools.zip.ZipFile.resolveLocalFileHeaderData(ZipFile.java:454)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:153)

Is the .war file screwed up? If so, why does it extract ok if I do it manually? I wasted approximately 4 hours of my life on this before embarking on a convoluted and silly workaround which is leaving me feeling defeated.

Advertisement

One comment

  1. Shishir · May 20, 2011

    ANT Error Message – java.lang.RuntimeException: data starting at XXX is in unknown format

    I just wasted entire day on stupid error from ANT:

    Build file:
    C:\XXXXXX\build.xml
    init:
    starteam:

    rubicon:
    lib_selection:
    build_td_manifest:
    compile:
    dist_no_test:

    BUILD FAILED
    C:\z\qc-project\qcdev\Server\TdCore\build.xml:139:
    java.lang.RuntimeException: data starting at 14600 is in unknown format

    Finally I found the simple solution – just run ‘clean’ target from the ANT file and run the main target again. So simple, so frustrating.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s