ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: if/else structure
Date Wed, 08 May 2002 18:48:40 GMT
the problem is that earlier versions of ant doesn't support the nested
contains element. :)

i guess the most simple solution is to force everyone to update their build
environment to use ant1.5Beta1.


-----Original Message-----
From: Diane Holt []
Sent: Wednesday, May 08, 2002 11:40 AM
To: Ant Users List
Subject: Re: if/else structure

--- 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 name="chkVersion">
    <condition property="is1.5" value="true">
      <contains string="${ant.version}" substring="1.5Beta1"/>



Do You Yahoo!?
Yahoo! Health - your guide to health and wellness

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

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

View raw message