ant-dev mailing list archives

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

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
always.

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}/${application.name}.war *"/>
        </exec>

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

Currently I am doing something like this:
    <condition property="no.roundup.support">
        <or>
            <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...
        </or>
    </condition>

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

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

    <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?

Cheers,
Magesh

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message