Thanks to all. I got the concept now.

Regards,
Irfan

-----Original Message-----
From: David Weintraub [mailto:[EMAIL PROTECTED] 
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,  <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to