Grokbase Groups Ant user May 2016

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:

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
groupuser @
postedMay 1, '16 at 4:08a
activeMay 1, '16 at 1:55p

2 users in discussion

Dave Glasser: 2 posts Stefan Bodewig: 1 post



site design / logo © 2018 Grokbase