From cory@ObjectDynamics.com Wed Aug 9 20:48:04 2000 Return-Path: Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 65786 invoked from network); 9 Aug 2000 20:48:04 -0000 Received: from corelli.siteprotect.com (64.26.0.79) by locus.apache.org with SMTP; 9 Aug 2000 20:48:04 -0000 Received: from harpo (tc00079.skypoint.net [199.199.158.79]) by corelli.siteprotect.com (8.9.3/8.9.3) with SMTP id PAA16889 for ; Wed, 9 Aug 2000 15:48:01 -0500 Message-ID: <015a01c00243$8e9d9410$4f9ec7c7@harpo> From: "Cory Wandling" To: References: <8F067DECB72DD411945E00B0D020236C188057@cgycorp-exch01.netshepherd.com> Subject: Re: Using if/unless within a target Date: Wed, 9 Aug 2000 15:51:13 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0157_01C00219.A50881D0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_0157_01C00219.A50881D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Using if/unless within a targetDon't put the ${} around the property. ----- Original Message -----=20 From: Bohnet, Ralph=20 To: 'ant-user@jakarta.apache.org'=20 Sent: Wednesday, August 09, 2000 3:37 PM Subject: Using if/unless within a target I am trying to use "if" within a target tag, and the documentation = indicates that if the property is set, the target will be executed. The = small buildfile below indicates that this is not the case. When I = execute this buildfile, I would expect to see: "executing test1", = instead I don't see any echo messages. Likewise, if I replace the "if" = with "unless", I see both echo messages. =20 Have I set this up incorrectly? When I turn on verbose, I see the = message that "string.present" is set to true.=20 This behavior seems buggy and contrary to the documentation.=20 I am using the release version 1.1, and have also tried it with last = night's build (08/09) with the same result.=20 Ralph Bohnet=20 ------=20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 --------=20 ------=_NextPart_000_0157_01C00219.A50881D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Using if/unless within a target
Don't put the ${} around the property.
----- Original Message -----
From:=20 Bohnet,=20 Ralph
To: 'ant-user@jakarta.apache.org' =
Sent: Wednesday, August 09, = 2000 3:37=20 PM
Subject: Using if/unless within = a=20 target


I am trying to use "if" within a target = tag, and=20 the documentation indicates that if the property is set, the target = will be=20 executed.  The small buildfile below indicates that this is not = the=20 case.  When I execute this buildfile, I would expect to see: = "executing=20 test1", instead I don't see any echo messages.  Likewise, if I = replace=20 the "if" with "unless", I see both echo messages. 

Have I set this up incorrectly?  = When I turn=20 on verbose, I see the message that "string.present" is set to = true.=20
This behavior seems buggy and contrary = to the=20 documentation.

I am using the release version 1.1, and = have also=20 tried it with last night's build (08/09) with the same result. =

Ralph Bohnet

------
<project name=3D"testConditions" default=3D"all" = >
  <target name=3D"check_for_depend" = >=20
    <available=20 property=3D"string.present" classname=3D"java.lang.String" = />
    <available = property=3D"not.present"=20 classname=3D"foo"=20 = />           &n= bsp; =20
  </target> =

  <target name=3D"test1"=20 depends=3D"check_for_depend" if=3D"${string.present}"> =
    <echo message=3D"executing = test1"/>       
  </target>

  <target name=3D"test2"=20 depends=3D"check_for_depend" if=3D"${not.present}"> =
    <echo message=3D"executing=20 test2"/>       
  </target>
 
  = <target name=3D"all"=20 depends=3D"test1,test2" />
</project>
--------=20

------=_NextPart_000_0157_01C00219.A50881D0--