when i run the code it shows er...">

Another option in place of the <bool> tag

<if> <bool> <isgreaterthan arg1="${abc}" arg2="${xyz}"/> </bool> </if> 

when i run the code it shows error if doesn't support the nested "bool" element. is there any other option in place of bool that is supported by if

+2
source share
4 answers

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> 

see Flaka’s detailed manual for more details!

+1
source

The example works in antcontrib-1.0b2, but not in the latest version of antcontrib-1.0b3

This is detected after reaching a similar problem after updating

+5
source

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.

+1
source

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> 
0
source

Source: https://habr.com/ru/post/898413/


All Articles