6

I have code for creating zip file in ant build script.

<target name="zip-dist" description="archiving artifacts">
    <zip destfile="${artifacts}/${zipfile}.zip" update="false" basedir="${target.dist}" includes="*.xyz-*" />
</target>

When file is being extracted using win zip right click -> Extract All... there's no warning, but while extracting with 7-zip showing 'Warnings: Headers Error' but its successful.

I know this has no effect on the output as its just a warning so suggested users to ignore it or use win-zip method.

But trust me it is impossible to make them understand and they all are keep on eating my head. There are many users and I am banging my head repeating same thing again and again. Still they want it to be fixed.

Can I use any attribute in ant-zip target or should I use any different zipping technique in ant build?

I have searched multiple online sources, this is last hope! Please help.

Prem
  • 316
  • 1
  • 5
  • 23

2 Answers2

4

I had the same issue.
Fixed adding only one attribute, to force Zip64 extensions:

zip64Mode="always"

Try and should work for you too.

סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
0

Instead of regular zip target used 7-zip to create zip.

<property name="7z.exe" value="C:/Program Files/7-Zip/7z.exe" />

<target name="zip-dist" description="archiving artifacts">
    <exec executable="${7z.exe}">
        <arg value="a" />
        <arg value="-tzip" />
        <arg value="${artifacts}/${zipfile}.zip" />
        <arg value="${target.dist}/*.xyz-*" />
    </exec>
</target>

As 7-zip includes all necessary information regarding header, so that warning will not occur.

Of course, 7-zip must be available in system.

Prem
  • 316
  • 1
  • 5
  • 23