java - Using Ant condition tag -
i want this
<target name="init" description="create build directories. > <mkdir dir="bin" /> <mkdir dir="dist" /> <!-- check presence of dependent jars --> <condition property="dependent.files.available"> <and> <available file="../../xx.jar" /> <available file="../../yy.jar" /> </and> </condition> </target> <!--- compile --> <target name="compile" depends="init" description="compile java sources , create classes"> <if> <isset property="dependent.files.available"/> <then> <javac srcdir="src" destdir="bin" classpathref="ext_jar_classpath"/> </then> <else> <echo message="either xx.jar or yy.jar not found"/> </else> </if> </target>
when tried compile code gave me following error
problem: failed create task or type if cause: name undefined. action: check spelling. action: check custom tasks/types have been declared. action: check <presetdef>/<macrodef> declarations have taken place
it correct way of doing it?
you need have ant-contrib
jar visible @ runtime, or configure correctly described in link.
the thing boils down have ant load task definition, if put ant-contrib
in ant/lib, need
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
Comments
Post a Comment