ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S. Alan Ezust" <>
Subject Re: Assign new value to an existing property
Date Fri, 30 Apr 2004 15:10:54 GMT
This isn't exactly the same thing, but sometimes when I want to call
a target with a different property value, I do this.

<project name="testargs"
    default="foo" basedir=".">

<property name="basefile" value="index.xml" />

<target name="somethingelse">
    <antcall target="foo">
        <param name="basefile" value="addendum.xml"/>

<target name="foo">
   <echo message="The property basefile = ${basefile}" />

On April 30, 2004 08:41 am, Daniels, Doug wrote:
> You can try using the ant-contrib(
> <variable> task:
> "The Variable task provides a mutable property to Ant and works much like
> variable assignment in Java. This task is similar to the standard Ant
> Property task, except that THESE PROPERTIES ARE MUTABLE. While this goes
> against the standard Ant use of properties, occasionally it is useful to be
> able to change a property value within the build. In general, use of this
> task is DISCOURAGED, and the standard Ant Property should be used if
> possible. Having said that, in real life I use this a lot."
> (
> To use the ant-contrib tasks download the ant-contrib jar, then in your
> build file place this <taskdef> at the top: <taskdef
> resource="net/sf/antcontrib/">
>   <classpath>
>     <pathelement location="/usr/share/java/lib/ant-contrib-0.3.jar"/>
>   </classpath>
> </taskdef>
> With the location pointing to where you downloaded your jar of course. A
> million thanks to the ant-contrib people for producing such useful tasks.
> I've always been kind of confused why most of the tasks aren't included in
> the regular ant distribution, I guess its that whole minimalist approach
> and you can always just download these tasks.
> ~ Doug Daniels
> -----Original Message-----
> From: Paul Martel []
> Sent: Friday, April 30, 2004 8:25 AM
> To:
> Subject: Assign new value to an existing property
> Hi !
> I defined a property X with a value.  Later in my Ant script, I would like
> to change the value of X.  Is it the kind of thing that I can do with Ant ?
>  At first glance, it seems not possible with a test that I have done.
> Thank you
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

S. Alan Ezust
Ottawa, Ontario, Canada

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message