ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: if/else structure
Date Wed, 08 May 2002 18:39:38 GMT
--- 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: <>

View raw message