ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kerry, Richard" <>
Subject RE: Use of Ant's zip task - ensuring file order follows the rules for Epub3
Date Fri, 14 Jun 2013 12:36:44 GMT

I've had an answer from someone on the Docbook mailing list (which is the context within which
I need to do this task).

The answer is to generate a separate zip-file containing only the file that must come first.

Then the other files and directories are added to it.  (Most of the rest of the data is in
directories, so the answer below would appear not to be applicable as it appears to require
files only)

The example I've based mine on is at

To be more complete, two zip files are created, one containing only the "mimetype" file and
the other containing the rest.  These two can then be merged, creating one file with the requirements
as stated.

(Also the "mimetype" file must not be compressed.  This tends to happen anyway, probably due
to its very small size (21 characters), but it's good to be able to specify it to ensure this
is done)



Richard Kerry
BNCS Engineer
T: +44 (0)20 82259063
M: +44 (0)7812 325518
Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ<><>

This e-mail and the documents attached are confidential and intended solely for the addressee;
it may also be privileged. If you receive this e-mail in error, please notify the sender immediately
and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability
cannot be triggered for the message content. Although the sender endeavours to maintain a
computer virus-free network, the sender does not warrant that this transmission is virus-free
and will not be liable
From: Stefan Bodewig []
Sent: 14 June 2013 13:09
Subject: Re: Use of Ant's zip task - ensuring file order follows the rules for Epub3

On 2013-06-14, Kerry, Richard wrote:

> Does anyone have experience of Ant's zip task - in particular for
> building epub3 documents ?

Not for building epub3 documents but I know a thing about the task or
two :-)

> One of the rules for epub3 is that the mimetype file comes first.  It
> appears that this can't be enforced using Ant's zip task.  Does anyone
> know if there is any way of making this work ?  Or do I need to call
> out to an external application ?  (ie infozip's zip.exe.  7-zip
> doesn't appear to do it either).

Ant will always add directory entries before file entries unless you set
filesonly to true.  Without that you don't have any chance unless the
files you need first are in the top level directory.

If you don't need directories or the special files all live inside the
top level dir it should work if you specify the files that need specific
order explicitly in a filelist (which preserves order) or file resources
before specifying any filesets.

Something like

<zip filesonly="true" ...>
  <file file="mime-type-thingy"/>
  <fileset dir="where your content is">
    <exclude name="mime-type-thingy"/>


To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message