ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Order of attributes signifificant in zipfileset?
Date Sun, 01 May 2016 04:30:35 GMT
On 2016-05-01, Dave Glasser wrote:

> I discovered this in ant 1.6.5, and found that it still behaves this way in 1.9.7.
> If you have a <zipfileset> element with both a dir and a file attribute, it will
produce different results depending on the order in which those attributes appear. If the
file attribute appears first, it behaves as you would expect. For example, with this:
> <zipfileset file="file1.txt" dir="dir1"/>
> It looks for a file named "file1.txt" inside the directory "dir1". However, with this:
> <zipfileset dir="dir1" file="file1.txt"/>
> It looks for file1.txt inside the current working directory.

I can confirm this to be true for any kind of fileset - the reason is
the way the file attribute is implemented in AbstractFileSet.
Internally file is translated to setting dir and includes, so whicherver
attribute is reached later it wins when setting the dir attribute.

> Is this a known, and expected behavior?  Is it documented anywhere?

At least I wasn't aware of it so far. I would have expected Ant to throw
a BuildException if you wanted to set both attributes at the same time
and would like to make it do just that for 1.9.8/1.10.0. Do you want to
create a bug report for this?

What you want to do for your build files is to set dir and includes
rather than dir and file.

<zipfileset dir="dir1" includes="file1.txt"/>



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

View raw message