ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Irfan.Sa...@t-systems.com>
Subject RE: how to change the property value at run time
Date Thu, 15 May 2008 10:08:28 GMT
Thanks to all. I got the concept now.

Regards,
Irfan

-----Original Message-----
From: David Weintraub [mailto:qazwart@gmail.com] 
Sent: Thursday, May 15, 2008 7:10 AM
To: Ant Users List
Subject: Re: how to change the property value at run time

Once an Ant property is set, you can't change it. However, there are a
few ways to get around this:

1). In an antcall, you set <param> and these parameters are inherited
as properties in the called target:

<target name="first">
    <antcall target="subtask">
        <param name="param1" value="${JAVA_HOME}"/>
    </antcall>
</target>

<target name="second">
    <antcall target="subtask">
       <param name="param1" value="d:/install"/>
    </antcall>
</target>

<target name="default"
     depends="first,second"/>

<target name="subtask">
    <echo message="Param1 is now set to ${param1}"/>
</target>

2). You can do something similar with macrodef

3). Use AntContrib's <var> task:
http://ant-contrib.sourceforge.net/tasks/tasks/variable_task.html.

Running "ant default" will print out two different values for ${param1}.
On Wed, May 14, 2008 at 9:20 AM,  <Irfan.Sayed@t-systems.com> wrote:
> Hi All,
>
>
>
> I need to change the value of a specific property at run time. Can
> somebody please let me know how I can do that.
>
>
>
> Let's say the property name is "JAVA_HOME" and suppose I want to
change
> the value of that property to "d:\install"
>
>
>
> Please help.
>
>
>
> Regards,
>
> Irfan
>
>
>
>



-- 
--
David Weintraub
qazwart@gmail.com

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


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


Mime
View raw message