Orangevolt ANT Tasks » Tasks » compare
Element containscall

2.7.7.  Example

This simple example tests if the java runtime version is 1.4 (or higher). Otherwise fails with an error message. The comparison is done numerical.

build.xml
<?xml version="1.0"?>  
 
<project basedir="." name="properties-test" default="main">
  <taskdef classpath="orangevolt-ant-tasks-1.3.2.jar" resource="com/orangevolt/tools/ant/taskdefs.properties"/>
 
  <target name="main">
    <compare arg1="${ant.java.version}" arg2="1.4" numeric="true">
      <lesser property="lesserThanJava14"/>
    </compare>
    <fail if="lessThanJava14">  
      java version 1.4 or higher is required !
    </fail>
  </target>
</project>

You can use multiple inner elements with same comparison at once. Defining multiple <lesser> elements inside compare for example is allowed.