Another option in place of the <bool> tag
Ant Flaka is the new Ant plugin that provides an innovative expression language that makes many parts of scripts obsolete. In addition, Flaka provides conditional and repetitive control structures, for example, when, if, for now, for, select, do not switch .. Your if statement with Flaka will look like this:
<project xmlns:fl="antlib:it.haefelinger.flaka"> <property name="digitA" value="42"/> <property name="digitB" value="23"/> <property name="wordA" value="abcd"/> <property name="wordB" value="efgh"/> <!-- compare of digits --> <fl:when test=" '${digitA}' > '${digitB}' "> <echo>${digitA} gt ${digitB}</echo> </fl:when> <!-- example with string compare in switch --> <fl:switch value="${wordA}"> <cmp gt="${wordB}"> <echo>${wordA} gt ${wordB}</echo> </cmp> <cmp lt="${wordB}"> <echo>${wordA} lt ${wordB}</echo> </cmp> </fl:switch> </project>
It looks like you are trying to use the Antelope if
task , because it (unlike ant -contrib if
) supports a nested bool
element. But an error message indicates that the task definition is correct.
Make sure you have the Antelope banner and the appropriate taskdef in your build file. I use this:
<taskdef resource="ise/antelope/tasks/antlib.xml" classpath="path/to/AntelopeTasks_3.5.1.jar" />
For more information on what this task supports, see the documentation linked above.
You can use the "bool" tag inside the "if" if you use the taskdef for the "if" using the class name = "ise.antelope.tasks.IfTask"
For instance:
<target name="compare"> <taskdef name="if" classname="ise.antelope.tasks.IfTask"/> <var name="abc" value="2" /> <var name="xyz" value="1" /> <if> <bool> <isgreaterthan arg1="${abc}" arg2="${xyz}"/> </bool> <echo message="${abc} is greater than ${xyz}" /> </if> </target>