How to resolve 7-zip's 'Warnings: Headers Error' from .zip created by Ant build?
Asked Answered
C

2

8

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.

Commorancy answered 19/8, 2019 at 13:33 Comment(0)
V
4

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

zip64Mode="always"

Try and should work for you too.

Vogele answered 7/1, 2020 at 17:34 Comment(2)
Could you please specify to which element you added this attribute?Diatomaceous
@Diatomaceous it is a zip task attribute what else ;-) <zip zip64Mode="always" ..... />Vogele
C
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.

Commorancy answered 20/8, 2019 at 8:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.