I’m encountering a strange issue in an ANT file I use for building a Java app. When generating the jar file, eventually I include resource files (images, fonts and config files) in the JAR using zipfileset, like this:
<zipfileset dir="src/res" prefix="res"/>
<zipfileset dir="src/res/images" prefix="res/images" />
<zipfileset dir="src/res/images/Bubbles" prefix="res/images/Bubbles"/>
<zipfileset dir="src/res/images/Clocks" prefix="res/images/Clocks"/>
<zipfileset dir="src/config" prefix="res/config"/>
<zipfileset dir="src/ontology" prefix="res/ontology"/>
To mantain original structure, that looks like this:
res
|-images
| |-Bubbles
| |-Clocks
|-fonts
|-config
|-ontology
Within the JAR, I’m using the prefix parameter in zipfileset. I’m getting duplicated images in res/images and triple images (3 copies of the same image) in any of the res/images/Bubbles and res/images/Clocks folders, which, in the other hand, are 2 and 3 depth levels respectively. res/config and res/ontology are correct, no duplicated files there…a screenshot to see what I mean:

I forgot to mention, but obviously, I only have one instance of each image in every folder. Any ideas what is causing this behaviour?
Regards,
Alex
antactually does exactly what you told it do. You told him to:src/resand to map them tores.src/res/imagesand to map them tores/imagessrc/res/images/Bubblesand to them underres/images/BubblesNow let’s assume that you have a
src/res/images/Bubbles/activity_bubble_orange.pngfiles. That file is contained in the first zipfileset, the second zipfileset and the third zipfileset. Ergo it will be packed three times.To do what you want you need to do a single
<zipfileset dir="src/res" prefix="res" />but filter the contents using includes/excludes filters.See here: http://ant.apache.org/manual/Types/zipfileset.html where it say that is a type of fileset. and here: http://ant.apache.org/manual/Types/fileset.html to see how you specify includes/excludes filter for a fileset.