The Ant Contrib library has an if task, which looks like this:
<if> <my condition goes here> <then> </then> </if>
In raw Ant, you use a task condition that looks like this:
<condition property="condition.to.set"> <my condition goes here> </condition>
and then the conditional goal:
<target name="mine" if="condition.to.set">
I prefer Ant Contrib as it is easier to read.
source share