| Author |
Mutable Property in Ant Script
|
Daksh Mital
Greenhorn
Joined: Aug 19, 2007
Posts: 19
|
|
Hi All
I know the <property> task in ANt lest me define an immutable property.
I checked on net and found that using antcotrib.jar
one can define a mutable property (basically one whose value can be changed during run time)
I tried running the following sample code
But the response is something like
hoj: [echo] ---------->>>true [echo] ----------->>true
pqr: [echo] false [echo] false
When i make an ant call from one target to another the value in property just restores.
Can any body explain if this is default behavior or me missing something.
Immediate help would be appreciated
|
Daksh
|
 |
Ravindra Rawat
Ranch Hand
Joined: Dec 09, 2004
Posts: 34
|
|
|
You get the desired behavior if you change the global variable declarations as properties. Ant contrib documentation says properties can be overiden variables cannot may be something to do with it Documentation does not define behavior on antcalls, need to look at code to confirm.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14487
|
|
Ravindra Rawat wrote:You get the desired behavior if you change the global variable declarations as properties. Ant contrib documentation says properties can be overiden variables cannot may be something to do with it Documentation does not define behavior on antcalls, need to look at code to confirm.
Ant properties are immutable within an ant instance, and, unlike most property definitions, the first definition wins, not the last one. The command-line "-D" setting, pretty much overrules everything.
There are 2 ways for Ant to do a script call. Internally and externally. Ant can do an external ant script call and supply a whole new set of properties, but an internal call is stuck with the same properties as the caller has.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: Mutable Property in Ant Script
|
|
|