ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <sflo...@nc.rr.com>
Subject Re: How to pass Java system properties to a task defined in a taskdef ?
Date Thu, 23 Jul 2009 17:34:01 GMT

You can echo that property using

<echo message = "${user.home}"/>

Its automagically available via the Java system property...

On Thu, 23 Jul 2009, Scot P. Floess wrote:

>
> Well, user.home is a Java system property.  I'm guessing the intent is to 
> change that system property internal to the script?
>
> On Thu, 23 Jul 2009, Avlesh Singh wrote:
>
>> If you are trying to read the environment variable "user.home", this is how
>> you need to it:
>> 
>> <property environment="env"/>
>> <echo message = "${env.user.home}"/>
>> 
>> Cheers
>> Avlesh
>> 
>> On Thu, Jul 23, 2009 at 8:18 PM, Scot P. Floess <sfloess@nc.rr.com> wrote:
>> 
>>> 
>>> Are you trying to set it within your build.xml - like so:
>>> 
>>> <property name="user.home" value="alpha"/>
>>> 
>>> If so, I don't think that is going to work...
>>> 
>>> For example try this out:
>>> 
>>> <project>
>>>    <property name="user.home" value="alpha"/>
>>>    <echo message = "${user.home}"/>
>>> </project>
>>> 
>>> When I run this, I get:
>>> 
>>> Buildfile: build.xml
>>>     [echo] /home/sfloess
>>> 
>>> However, if I do this:
>>> 
>>> ant -Duser.home="bar"
>>> 
>>> I get:
>>> 
>>> Buildfile: build.xml
>>>     [echo] bar
>>> 
>>> Unless I am wrong, once Ant starts and those default properties are set 
>>> (in
>>> this case from Java system properties), it won't be reset to the new 
>>> value.
>>>  However, doing so on the command line sets it first.
>>> 
>>> 
>>> On Thu, 23 Jul 2009, Scot P. Floess wrote:
>>> 
>>> 
>>>> Just curious - you mention a modified user.home property...  How are you
>>>> modifying it?
>>>> 
>>>> On Thu, 23 Jul 2009, Jean-Noël Rivasseau wrote:
>>>>
>>>>  Hello,
>>>>> 
>>>>> I am launching Ant with a modified user.home property. This property
is
>>>>> apparently not passed down to one of my tasks, defined in a taskdef.

>>>>> Why?
>>>>> Does Ant fork a new VM for executing such tasks? In any case, how can
I
>>>>> pass
>>>>> this property to the task being executed, it's essential for me.
>>>>> 
>>>>> I had a look at the source but could not really understand where to look
>>>>> to
>>>>> understand how things worked.
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> Jean-Noel
>>>>> 
>>>>> 
>>>> Scot P. Floess
>>>> 27 Lake Royale
>>>> Louisburg, NC  27549
>>>> 
>>>> 252-478-8087 (Home)
>>>> 919-890-8117 (Work)
>>>> 
>>>> Chief Architect JPlate   http://sourceforge.net/projects/jplate
>>>> Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
>>>> 
>>>> Architect Keros          http://sourceforge.net/projects/keros
>>>> 
>>>> 
>>> Scot P. Floess
>>> 27 Lake Royale
>>> Louisburg, NC  27549
>>> 
>>> 252-478-8087 (Home)
>>> 919-890-8117 (Work)
>>> 
>>> Chief Architect JPlate   http://sourceforge.net/projects/jplate
>>> Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
>>> 
>>> Architect Keros          http://sourceforge.net/projects/keros
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>> 
>> 
>
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC  27549
>
> 252-478-8087 (Home)
> 919-890-8117 (Work)
>
> Chief Architect JPlate   http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
>
> Architect Keros          http://sourceforge.net/projects/keros
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

Mime
View raw message