Is there anyway to have an optional excludes file in the javac task? We
already have one excludesfile defined like this:
<target name="compile" depends="init, prepare_dirs">
<javac srcdir="${build.java}"
destdir="${build.classes}"
classpath="${CLASSPATH}"
optimize="${optimize}">
<patternset excludesfile="${build.java}/build_excludes" />
</javac>
</target>
But some of our developers maintain some files locally on their machines
that should not be part of the build compile. So, I am trying to modify the
build.xml to allow them to define their own optional "local" excludes file.
This file may or may not exist, but it is up to the caller to define the
property that descibes the location of the file. I am thinking something
like this:
<target name="compile" depends="init, prepare_dirs">
<javac srcdir="${build.java}"
destdir="${build.classes}"
classpath="${CLASSPATH}"
optimize="${optimize}">
<patternset excludesfile="${build.java}/build_excludes" />
<patternset excludesfile="${build.local_excludes}"
if="build.local_excludes"/>
</javac>
</target>
The above chunk does not cause a parse exception, but it ignores the if
attribute (I don't have the build.local_excludes property defined) and then
complains that it cannot find the file "${build.local_excludes}".
I have also tried to define a global patternset, but the property values do
not get replaced properly in the path (these values get set up in the init
task) and patternset does not appear to support something like this:
<patternset refid="compile_excludes" />
<excludesfile name="${build.java}/build_excludes" />
<excludesfile name="${build.local_excludes}" if="build.local_excludes"/>
</patternset>
It only supports "include" and "exclude" elements.
Is there another way to have optional exclude files?
Thanks,
-Mark