ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: if/else structure
Date Wed, 08 May 2002 18:39:38 GMT
--- Michael_Luu@NAI.com wrote:
> does anyone know if you're able to perform an if/else structure in ant?
> 
> i want to execute a target if the current version of ant is 1.5Beta1.

The if/unless attributes of a <target> check for whether the named
property is set (to any value), so to do an "if" on whether a property is
set to a specific value, you need to conditionally set a property using
the <condition> task, then use that property in your <target>'s if/unless.
For example:

  <target name="whatever" if="is1.5" depends="chkVersion">
    ...
  </target>

  <target name="chkVersion">
    <condition property="is1.5" value="true">
      <contains string="${ant.version}" substring="1.5Beta1"/>
    </condition>
  </target>

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message