I know that I am very late for this, but here is another way to do it if you use ant -contrib, where if does not support the nested antcall element (I use antcontrib 1.02b, which doesnβt work "t).
<target name="TaskUnderRightCondition" if="some.property"> ... </target>
You can extend this again to check if you need to set some.property just before this target is called, using the dependency depends on whether this is done before the if attribute is evaluated. So you can get the following:
<target name="TestSomeValue"> <condition property="some.property"> <equals arg1="${someval}" arg2="${someOtherVal}" /> </condition> </target> <target name="TaskUnderRightCondition" if="some.property" depends="TestSomeValue"> ... </target>
In this case, TestSomeValue is called, and if someval == someOtherVal, then some.property is set and, finally, TaskUnderRightCondition will be executed. If someval! = SomeOtherVal, then TaskUnderRightCondition will be skipped.
You can learn more about the conditions through the documentation .
source share