ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Champeau <schamp...@leaselink.com>
Subject Problem including/excluding files
Date Mon, 04 Jun 2001 19:55:24 GMT
I have been using Ant for a while now, and have always had trouble
understanding the rules it uses when including and excluding files from an
operation. (I am using 1.2, had problems with 1.3).

For example, I want to copy three files into a directory and zip them up.
Here are the two tasks, which work like I want.

<copy todir="${buildDir}/${clientUpdateDir}">
   <fileset dir="${buildDir}" >
      <patternset includes="${file1}, ${file2}, ${file3}"/>
   </fileset>
</copy>

<zip
   zipfile="${buildDir}/${testZipFile}">
   <fileset dir="${buildDir}" >
      <patternset includes="${file1}, ${file2}, ${file3}"/>
   </fileset>
</zip>

However, these really should not work, because according to the
documentation, when the "excludes" directive is omitted, "No files (except
default excludes) are excluded." Since I have specified no excludes,
shouldn't it include all files?
In an attempt to make things more maintainable, I broke the pattern set out
as a referenced object, and rewrote it as follows:
<patternset id="zipfiles" includes="${file1}, ${file2}, ${file3}"/>
<task...>
<copy todir="${buildDir}/${clientUpdateDir}">
   <fileset dir="${buildDir}" >
      <patternset refid="zipfiles"/>
   </fileset>
</copy>

<zip
   zipfile="${buildDir}/${testZipFile}">
   <fileset dir="${buildDir}" >
      <patternset refid="zipfiles"/>
   </fileset>
</zip>
</task>
Now, the excludes behavior does seem to be working like the documentation
states, because it attempts to copy everything in sight!
Are there special considerations for includes and excludes when using
referenced objects? Is there something fundamental I do not understand about
this? Is this a 1.2 issue?
Thanks,
Steve C.




Mime
View raw message