ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <j_a_fernan...@yahoo.com>
Subject RE: Project.setProperty(String,String)?
Date Tue, 26 Jun 2001 14:53:15 GMT
Properties are not supposed to be used in that way.

Properties are considered inmutable. Most probably your task in the target
is prepared just once (the property expanded) and when you call the second
time the expansion has been cached ***because it is not supposed to
change***.

The only safe way to do what you want is for your task to be based on <ant*>
tasks which create a new context of execution where all properties are
reevaluated.

At least that is my take on your problem,

Jose Alberto

> -----Original Message-----
> From: Bram.Smeets@smarthaven.com [mailto:Bram.Smeets@smarthaven.com]On
> Behalf Of Bram Smeets
> Sent: Tuesday, June 26, 2001 2:51 PM
> To: ant-dev@jakarta.apache.org
> Subject: Re: Project.setProperty(String,String)?
>
>
> I did some further investigation and the property gets
> changed every token
> found.
>
> So, how come the target which consists of:
>
> <target name="testing">
>   <echo message="${engine}"/>
> </target>
>
> still prints the former token??
> I don't understand this behaviour.....
>
> Because I retrieve the Target and execute it twice (there are
> two tokens in
> my string).
> Is this causing this behaviour, should I clone it or is it
> just impossible??
>
> Thanks in advance,
> Bram
>
> ----- Original Message -----
> From: "Stefan Bodewig" <bodewig@apache.org>
> To: <ant-dev@jakarta.apache.org>
> Sent: Tuesday, June 26, 2001 3:43 PM
> Subject: Re: Project.setProperty(String,String)?
>
>
> > Bram Smeets <bram@smarthaven.com> wrote:
> >
> > > The problem is that when I set the property the first
> time, the task
> > > executes by referencing the property.  The second time I set teh
> > > property, the task executes by referencing the old value!
> >
> > The only explanation I have for this is that your property is a
> > user-property (which means it cannot be changed by
> > Project.setProperty).
> >
> > I've added a message when an override is ignored to
> > Project.setProperty in CVS.
> >
> > Stefan
> >
>


Mime
View raw message