ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: zip from zip with mappers
Date Tue, 20 Nov 2012 05:05:46 GMT
On 2012-11-19, Patrick Martin wrote:

> I have a situation where I need to create an archive (zip) from an other
> one, but transforming some path inside. I want to avoid using a temporary
> folder structure as the input files contains a huge amount of entries
> (about 125000...) and this generates quite a lot of I/Os.

> I was thinking of using <zip> and <zipfileset>. However, as <zip> does
> support <mapper>, it is not possible directly.

> So I thought of using the <mappedresources> resource collection:
> <zip destfile="">
> <mappedresources enablemultiplemappings="true">
> <zipfileset src="" includes="**" />
> <firstmatchmapper> <mapper type="glob" from="fromfolder\*" to="tofolder\*"
> /> <identitymapper /> </firstmatchmapper>
> </mappedresources>
> </zip>

> The mapping is done quite fast but then zip is reeaaally slow (can be seen
> when running in verbose mode).

Yes, this is a known problem with the way Ant deals with zipfileset.

> My guess is that Ant will look for each resource individually and thus
> scan the source zip each time.

It's even worse.  The ZIP file will be reopened and the central
directory re-parsed every time an entry is read.  This is avoided by
special code inside the zip task when the zipfileset is nested directly
into the task.

> Is there any other possibility to achieve zip to zip transfer with mapping
> / transformation (and filtering with include/exclude patterns) ?
> Or is there any way to add <mapper> support in <zip> ?

Filtering should work by using zipfileset directly.  As for mapping, I'm
afraid there is no real solution - apart from coding the ZIP creation
directly in Java.


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

View raw message