why_vincent
why_vincent

Reputation: 2262

How to pass multiple excludes for fileset in Ant as an input parameter?

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>

Upvotes: 2

Views: 3575

Answers (1)

user3584056
user3584056

Reputation: 184

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.

Upvotes: 3

Related Questions