ANT: Using conditional tags, <IF>

ant, if-statement, tags

Solution

Alternately, once can include the following line in your ANT script

<taskdef resource="net/sf/antcontrib/antlib.xml" />

As long as `ant-contribs` is in your path, nothing else is needed

This solution is a bit cleaner, as one gains access to ALL the tags, not just the ones manually specified

Problem

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

Original source

Related problems