2

I am using a fileset in Ant and I would like to have the things to exclude as an extracted property, like an array of strings(or just a comma-separated string). By doing this I can have a dynamic excludelist.

<!-- IN MY PROPERTY FILE -->

thingsToExclude = File1.java,File2.java,File3.java

<!-- IN MY BUILD.XML -->

<fileset dir="${somePath}" casesensitive="yes">
    <exclude name="File1.java"/>
    <exclude name="File2.java"/>
    <exclude name="File3.java"/>
</fileset>


<!-- WHAT I WOULD LIKE -->

<fileset dir="${somePath}" casesensitive="yes">
    <excludeList name="${thingsToExclude}"/>
</fileset>
kenorb
  • 155,785
  • 88
  • 678
  • 743
why_vincent
  • 2,172
  • 9
  • 33
  • 49

1 Answers1

3

Use excludesfile attribute of fileset and point to your property file, that should do the trick.

excludesfile: the name of a file; each line of this file is taken to be an exclude pattern.

Of course, you can use regex pattern like *.java to exclude a set of files as well.

kenorb
  • 155,785
  • 88
  • 678
  • 743
user3584056
  • 184
  • 1
  • 6