Check conditions example:
<!-- run command -->
<target name="t_name">
<exec executable="command" failonerror="true" outputproperty="exec.out" errorproperty="exec.err" resultproperty="exec.rc" >
<arg value="arg"/>
</exec>
</target>
<!-- check conditions -->
<target name="checkresult">
<condition property="errors">
<not>
<equals arg1="${exec.err}" arg2="0" />
</not>
</condition>
<echo message="errors: ${errors}"/>
</target>
<!-- usage, target executes only if errors == 'false' -->
<target unless="errors"></target>
Run target from another target:
<!-- first way throw depends attribute, when execute first_target, then it execute all targets in depends list -->
<target name="first_target" depends="second_target, third_target, fourth_target">...</target>
<target name="second_target">...</target>
<target name="third_target">...</target>
<target name="fourth_target">...</target>
<!-- second way throw antcall tag -->
<target name="default">
<antcall target="doSomethingElse">
<param name="param1" value="value"/>
</antcall>
</target>
<target name="doSomethingElse">
<echo message="param1=${param1}"/>
</target>
Posted by konjoot to wiki (2014-01-06 09:29)