ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schmetzer <...@exubero.com>
Subject Re: How add global property with input task?
Date Sun, 13 Sep 2009 07:48:38 GMT
2009/9/12 don rhummy <donrhummy@yahoo.com>:
> When I have an Input task with "addProperty", the property it creates is only valid within
that one target. So if two targets are being called in the same build run, the property added
by the input task in target "1" is not visible in target "2"!! How would I add it globally?
>
> The below two examples BOTH have the property "newProp" as existing only in target "one":
>
> EXAMPLE ONE
> ------------
> <target name="one">
>     <input message="Enter something:" addProperty="newProp" />
> </target
>
>
> <target name="two">
>     <!-- Should NOT be called -->
>     <input message="Enter something:" addProperty="newProp" />
> </target
>
> //Command prompt call
> mycomp> ant one two

This example works for me (that is, the "one" target sets the
property, the "two" target does nothing. What version of ant are you
using?

> EXAMPLE TWO
> ------------
> <target name="one">
>     <input message="Enter something:" addProperty="newProp" />
> </target
>
>
> <target name="two">
>     <!-- Should NOT be called -->
>     <input message="Enter something:" addProperty="newProp" />
> </target
>
> <target name="three">
>     <antcall target="one" />
>     <antcall target="two" />
> </target
>
> //Command prompt call
> mycomp> ant three

What you are trying to do here will not work. The <antcall> task
actually sets up a completely new project, with its own properties.
What you probably want to do here is use depends instead, i.e.

<target name="three" depends="one, two"/>

Regards,
Joe

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message