I'm trying to use <concat> as a resource collection in a <zip> and found that it doesn't work so well.
First, an example: <zip destfile="target/dist.zip"> <concat> <fileset file="CHANGES.txt" /> </concat> </zip> This creates a zip file with multiple entries named "concat (C:", not a single entry containing the CHANGES.txt file. (The reason I'm playing with <concat> as a resource collection for a <zip>: I want to include all the files in my distribution verbatim, except the CHANGES.txt file I want to do property substitution. Since <concat> allows a <filterchain> I thought this would be a good way to do it. The snippet above is a stripped-down, simplified example that reproduces the problem.) I looked at the source for <zip> and <concat> and figured out why: the implementation of <concat> (as a ResourceCollection) returns a single, hard-coded name for the Resource it contains: public String getName() { return "concat (" + String.valueOf(c) + ")"; } I can't imagine such a construction is ever useful. I was able to work around this issue by using a <mappedresources>: <zip destfile="target/dist.zip"> <mappedresources> <concat> <fileset file="CHANGES.txt" /> </concat> <mergemapper to="CHANGES.txt" /> </mappedresources> </zip> but this is IMHO clunky and not terribly obvious. I propose two changes: 1. Allow the resource name to be specified when <concat> is used as a ResourceCollection; e.g., something like <zip destfile="target/dist.zip"> <concat name="CHANGES.txt"> <fileset file="CHANGES.txt" /> </concat> </zip> It would be helpful if getName() could automatically do this if <concat> itself contains a single Resource so it doesn't have to be specified as an attribute. 2. Throw a BuildException if getName() is called and no name is available. (In other words, fail fast rather than produce something useless.) Thoughts? Rich