You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Christopher Elkins <ce...@scardini.com> on 2000/10/20 22:33:06 UTC

Re: echo message does not translate properties

> I would like to echo back the value of properties to a user but the
> following
> <property name="aprop" value="abc" />
> <echo message="aprop = ${aprop}" />
> 
> results in
> 
> aprop = ${aprop}
> 
> 
> when I would like it to result in
> 
> aprop = abc
> 

Was this ever addressed? I don't see anything in the archives.

--
Christopher Elkins


RE: echo message does not translate properties

Posted by Wes Moulder <wm...@axyssolutions.com>.
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>

     <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>

I believe this will work.  Like I said, a bit kludgey, but if you don't
mind a duct tape and bailing wire sort of approach, it works.

--Wes


> -----Original Message-----
> From: Christopher Elkins [mailto:celkins@scardini.com]
> Sent: Friday, October 20, 2000 4:29 PM
> To: ant-user@jakarta.apache.org
> 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?
>


Re: echo message does not translate properties

Posted by Christopher Elkins <ce...@scardini.com>.
> 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?

> --Wes
>

--
Christopher Elkins


> > -----Original Message-----
> > From: Christopher Elkins [mailto:celkins@scardini.com]
> > Sent: Friday, October 20, 2000 4:21 PM
> > To: ant-user@jakarta.apache.org
> > Subject: Re: echo message does not translate properties
> >
> >
> >
> > Sorry, my bad. I should have elaborated, especially
> > considering that my
> > situation isn't exactly the same as the one in the original message.
> >
> > Ant version = 1.2rc2
> >
> > Build file
> > ----------
> >     <target name="check_for_optional_packages">
> >         <available property="jsdk2.2.present"
> > classname="javax.servlet.jsp.PageContext" value="false"/>
> >     </target>
> >
> >     <target name="env" depends="check_for_optional_packages">
> >         <echo message="jsdk2.2 = ${jsdk2.2.present}"/>
> >     </target>
> >
> > Output
> > ------
> >     C:\Projects\jakarta\turbine\build>build-turbine.bat env
> >     Buildfile: build-turbine.xml
> >
> >     check_for_optional_packages:
> >
> >     env:
> >     jsdk2.2 = ${jsdk2.2.present}
> >
> >     BUILD SUCCESSFUL
> >
> >     Total time: 1 second
> >
> >
> > Perhaps I'm misunderstanding the usage of the value attribute
> > in the available
> > tag, but in this scenario I'd expect to see:
> >     jsdk2.2 = false
> >
> > Am I missing something?
> >
> > --
> > Christopher Elkins
> >
> >
>
>


RE: echo message does not translate properties

Posted by Wes Moulder <wm...@axyssolutions.com>.
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.

--Wes

> -----Original Message-----
> From: Christopher Elkins [mailto:celkins@scardini.com]
> Sent: Friday, October 20, 2000 4:21 PM
> To: ant-user@jakarta.apache.org
> Subject: Re: echo message does not translate properties
>
>
>
> Sorry, my bad. I should have elaborated, especially
> considering that my
> situation isn't exactly the same as the one in the original message.
>
> Ant version = 1.2rc2
>
> Build file
> ----------
>     <target name="check_for_optional_packages">
>         <available property="jsdk2.2.present"
> classname="javax.servlet.jsp.PageContext" value="false"/>
>     </target>
>
>     <target name="env" depends="check_for_optional_packages">
>         <echo message="jsdk2.2 = ${jsdk2.2.present}"/>
>     </target>
>
> Output
> ------
>     C:\Projects\jakarta\turbine\build>build-turbine.bat env
>     Buildfile: build-turbine.xml
>
>     check_for_optional_packages:
>
>     env:
>     jsdk2.2 = ${jsdk2.2.present}
>
>     BUILD SUCCESSFUL
>
>     Total time: 1 second
>
>
> Perhaps I'm misunderstanding the usage of the value attribute
> in the available
> tag, but in this scenario I'd expect to see:
>     jsdk2.2 = false
>
> Am I missing something?
>
> --
> Christopher Elkins
>
>


Re: echo message does not translate properties

Posted by Christopher Elkins <ce...@scardini.com>.
> In what context and with what version of ant do you see this behavior? Using
> 1.2rc1 I am able to echo the properties defined within a target.
>
Sorry, my bad. I should have elaborated, especially considering that my
situation isn't exactly the same as the one in the original message.

Ant version = 1.2rc2

Build file
----------
    <target name="check_for_optional_packages">
        <available property="jsdk2.2.present"
classname="javax.servlet.jsp.PageContext" value="false"/>
    </target>

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

Output
------
    C:\Projects\jakarta\turbine\build>build-turbine.bat env
    Buildfile: build-turbine.xml

    check_for_optional_packages:

    env:
    jsdk2.2 = ${jsdk2.2.present}

    BUILD SUCCESSFUL

    Total time: 1 second


Perhaps I'm misunderstanding the usage of the value attribute in the available
tag, but in this scenario I'd expect to see:
    jsdk2.2 = false

Am I missing something?

--
Christopher Elkins


Re: echo message does not translate properties

Posted by Scott M Stark <Sc...@displayscape.com>.
In what context and with what version of ant do you see this behavior? Using
1.2rc1 I am able to echo the properties defined within a target.

bash-2.04$ ant -version
Ant version 1.2rc1 compiled on October 14 2000
bash-2.04$ cat tst.xml
<?xml version="1.0" encoding="UTF-8"?>

<project name="JavaSerializationTests" default="run" basedir="./">

        <target name="run">
                <property name="version" value="V0" />
                <echo message="in run, version = ${version}" />
                <antcall target="runV">
                        <param name="version" value="${version}" />
                </antcall>
        </target>

        <target name="runV">
                <echo message="in runV, version = ${version}" />
        </target>

</project>
bash-2.04$ ant -buildfile tst.xml
Buildfile: ..\tst.xml

run:
in run, version = V0

runV:
in runV, version = V0

BUILD SUCCESSFUL

Total time: 0 seconds

----- Original Message ----- 
From: "Christopher Elkins" <ce...@scardini.com>
To: <an...@jakarta.apache.org>
Sent: Friday, October 20, 2000 1:33 PM
Subject: Re: echo message does not translate properties


> > I would like to echo back the value of properties to a user but the
> > following
> > <property name="aprop" value="abc" />
> > <echo message="aprop = ${aprop}" />
> > 
> > results in
> > 
> > aprop = ${aprop}
> > 
> > 
> > when I would like it to result in
> > 
> > aprop = abc
> > 
> 
> Was this ever addressed? I don't see anything in the archives.
> 
> --
> Christopher Elkins
> 
>