You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Magesh Umasankar <um...@apache.org> on 2004/07/02 16:48:23 UTC
Version condition
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
Re: Version condition
Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 2 Jul 2004, Magesh Umasankar <um...@apache.org> wrote:
> I felt the need for a <antversion> condition today.
Would probably be nice to have, yes.
> <available> usually works ok for major releases, but for minor ones,
> it may not always.
In the 1.6.2 case it will, use oata.DynamicConfiguratorNS.
Cheers
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org