I would like to do something like this
<target name="clean" description="clean">
<if>
<available file="${build}" type="dir" />
<then>
<delete dir="${build}" />
</then>
</if>
</target>
As per suggestions found on stackoverflow.com, i downloaded ant-contrib-1.0b3.jar and put it into my path
Additionally, under Ant Build configuration, in classpath, i have
When running my ANT script, i still get
BUILD FAILED
C:\Repositories\blah\build.xml:60: Problem: failed to create task or type if
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
What am i missing? Please advise
If the condition on the <if> is false, then the first <elseif> who's conditional evaluates to true will be executed. The <else> will be executed only if the <if> and all <elseif> conditions are false.
The Ant tasks process these files in a case-sensitive way.
isset is a conditional to test whether a given property has been set.
A target is a container of tasks and datatypes that cooperate to reach a desired state during the build process. Targets can depend on other targets and Apache Ant ensures that these other targets have been executed before the current target.
export ANT_HOME=/path/to/ant/apache-ant-1.8.2
I couldn't get it to work until I had ANT_HOME set properly. Java kept picking another ant installed on the box.
Same issue resolved in that way. I put at the start of the buid XML file the following lines:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="your/path/to/ant-contrib-${version}.jar" />
</classpath>
</taskdef>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With