ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magesh Umasankar" <>
Subject Version condition
Date Fri, 02 Jul 2004 14:48:23 GMT

First of all, thanks, Antoine for getting out the beta today.

I felt the need for a <antversion> condition today.  I am aware
of the different techniques used - i.e., using the ant.version
property or using <available> and checking for a classname
that is unique to a particular release of Ant.  <available> usually
works ok for major releases, but for minor ones, it may not

My situation is this:
I want to do the following if Ant runtime version is <= 1.6.1:

        <exec dir="${build.war}" executable="jar">
            <arg line="-cf ${build.ear}/${}.war *"/>

I want to do the following if Ant runtime version is > 1.6.1 (including beta
        <jar jarfile="${build.ear}/${}.war"
            basedir="${build.war}" roundup="false"/>

Currently I am doing something like this:
    <condition property="">
            <equals arg1="${ant.version}" arg2="1.6"/>
            <contains string="${ant.version}" substring="1.6.1"/>
            <contains string="${ant.version}" substring="1.5"/>
            <contains string="${ant.version}" substring="1.4"/>
..and so on...

    <target name="exec_jar_war" if="">
        <exec dir="${build.war}" executable="jar">
            <arg line="-cf ${build.ear}/${}.war *"/>

    <target name="rounddown_jar_war" unless="">
        <jar jarfile="${build.ear}/${}.war"
            basedir="${build.war}" roundup="false"/>

    <target name="jar_war" depends="exec_jar_war,rounddown_jar_war"/>

Is there a reliable built-in way (or a more elegant way) of achieving this?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message