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
On the tasks tab for your Ant Runtime do you see the 'if' task?
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:
I got the same issue. I resolved in the following way. Sometimes this might be compatibility problem.
Alternately, once can include the following line in your ANT script
As long as
ant-contribs
is in your path, nothing else is neededThis solution is a bit cleaner, as one gains access to ALL the tags, not just the ones manually specified
The standard ant way would be something like =
A snippet with the Ant Plugin Flaka, a recent alternative to antcontrib. Installation in Eclipse as usual via
Preferences | Ant | Runtime | Global Entries | ant-flaka-1.02.-1.02.jar =
output with ant -f build.xml -Dbuildtype=prod or
ant -f build.xml -Dbuildtype=prod -Ddummybuild=whatever
output with typo => ant - build.xml -Dbuildtype=testt
output with ant -f build.xml -Ddummybuild=whatever