I want to add an exclusion list, if and only if the paternset actually exists. I wasn't sure how to check if a patternset exists, so I added a regular property to serve as a flag.
<echo message="${property::exists('package.processSpecials')}" />
<fileset id="subprojects" basedir="${build.workspace}" >
<include name="*" />
<patternset refid="package.excludespecials" if="package.processSpecials" />
</fileset>
This fails because package.excludespecials does not exist, even though package.processSpecials does not exist.
[echo] False
BUILD FAILED
...package.build(288,10):
patternset reference 'package.excludespecials' not defined.
I tried putting an if statement inside the fileset definition, but it was an unexpected element.
My other alternative that feels a bit clunky is:
<if test="${property::exists('package.processSpecials')}">
<fileset id="subprojects" basedir="${build.workspace}" >
<include name="*" />
<patternset refid="package.excludespecials" />
</fileset>
</if>
<if test="${not property::exists('package.processSpecials')}">
<fileset id="subprojects" basedir="${build.workspace}" >
<include name="*" />
</fileset>
</if>