ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject RE: echo message does not translate properties
Date Sat, 21 Oct 2000 02:34:00 GMT
--- Wes Moulder <> wrote:
> In a non-convoluted way? No. In a slightly less than obvious way?
> Try: 
>      <target name="check_for_optional_packages">
>          <available property="jsdk2.2.present"
>             classname="javax.servlet.jsp.PageContext" value="false"/>
>      </target>

This won't work, because as someone wrote earlier, <available> will only
set the specified property if in fact the thing being checked for really
is available (ie., you can't set the property to false, because if what
you're asking about isn't avaiable then the property won't get set at

>      <target name="env" depends="check_for_optional_packages">
>          <echo message="jsdk2.2 = ${jsdk2.2.present}"
>             if="${jsdk2.2.present}"/>
>          <echo message="jsdk2.2 = false" unless="${jsdk2.2.present}" />
>      </target>

This won't work, because the if/unless construct is only available at the
target level, not at the task level.

The following example does work -- but please note: <property> is broken!
It's supposed to set the value to "true" by default, but unless you
explicitly set it to "true", any if/unless you try on a property set by
<property> will always come up with that property as NOT set. I sent mail
about this a day or so ago, but haven't heard anything more about it. Also
note -- nowhere is a property being set to the value of "false" -- it's
simply hard-coded into the <echo>, since that's the only other possible
state of things):

  <target name="classavail" depends="chkfalse" unless="nogots">
    <echo message="  It is ${avail} that the class is available."/>

  <target name="chkfalse" depends="chkclass" unless="avail">
    <echo message=" It is false that the class is available."/>
    <property name="nogots" value="true"/>

  <target name="chkclass">
    <available property="avail" classname="Widget"


> > -----Original Message-----
> > From: Christopher Elkins []
> > Sent: Friday, October 20, 2000 4:29 PM
> > To:
> > Subject: Re: echo message does not translate properties
> >
> >
> >
> > > Yes, the available tag only sets the property if the file/class is
> > > available.  This is a good thing since the if/unless does
> > the same check,
> > > not to check and see if they meet any condition.
> > >
> > Thanks. I just re-read the docs and now realize I completely
> > misunderstood the
> > purpose of that value attribute.
> >
> > Here's what I'd like to do: if a specific class is present,
> > print "true"; if
> > it's not, print "false". If I use the value tag properly, I
> > can get "true" when
> > it's present. However, when it's not, I just get the property
> > identifier; I'd
> > like to get "false".  Is this possible in a non-convoluted way?
> >


Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.

View raw message