ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wannheden, Knut" <K...@paranor.ch>
Subject RE: nested ${} expressions
Date Tue, 15 Jan 2002 14:46:30 GMT
after

	<property name="c" value="${a}.${b}"/>

has been executed 'c' will have the value 'aaa.bbb'.

	<property name="aaa.bbb" value="x"/>

property 'aaa.bbb' will have the value 'x'.

	<property name="d" value="${c}"/>

property 'd' will have the value of 'c' which is 'aaa.bbb'.

to get the thing you're talking about to work, you would have to write:

	<property name="d" value="${${c}}"/>

but this is a nested property and unfortunately not allowed.  i remember
that someone once posted a custom task which would allow something similar.
it would allow something like:

	<propertyref name="d" value="${c}"/>

this would create a property 'd' with the value of the property with name
'${c}' ('aaa.bbb' in this case).  i don't remember when this was posted or
what the task was called, but you might find it in the archives.

maybe you can explain what exactly you would use this for.  maybe someone
could suggest another (and maybe easier) solution to your problem.

--
knut

> -----Original Message-----
> From: Rahamim, Zvi (Zvi) [mailto:zrahamim@avaya.com]
> Sent: Dienstag, 15. Januar 2002 15:21
> To: Ant Users List
> Subject: RE: nested ${} expressions
> 
> 
> I want that d will have the value: 'x'
> When I do this, it doesn't work:
> 
>   <property name="a" value="aaa"/>
>   <property name="b" value="bbb"/>
>   <property name="c" value="${a}.${b}"/>
>   <property name="aaa.bbb" value="x"/>
>   <property name="d" value="${c}"/>
> 
> 
> Zvi
> 
> -----Original Message-----
> From: Wannheden, Knut [mailto:Knut@paranor.ch]
> Sent: Tuesday, January 15, 2002 3:46 PM
> To: 'Ant Users List'
> Subject: RE: nested ${} expressions
> 
> 
> well, it's probably due to the fact that your <property>-task for
> property
> 'c' was processed before the tasks for the properties 'a' and 
> 'b'.  i.e.
> 
>   <property name="a" value="aaa"/>
>   <property name="b" value="bbb"/>
>   <property name="c" value="${a}.${b}"/>
> 
> will work, but
> 
>   <property name="c" value="${a}.${b}"/>
>   <property name="a" value="aaa"/>
>   <property name="b" value="bbb"/>
> 
> won't.  hope this helps.
> 
> > -----Original Message-----
> > From: Rahamim, Zvi (Zvi) [mailto:zrahamim@avaya.com]
> > Sent: Dienstag, 15. Januar 2002 14:05
> > To: Ant Users List
> > Subject: RE: nested ${} expressions
> > 
> > 
> > I've tried to create a property:
> > name="c" value="${a}.${b}"
> > and then get the value: ${c}
> > Why doesn't it work?
> > 
> > Zvi 
> > 
> > 
> > 
> > -----Original Message-----
> > From: Wannheden, Knut [mailto:Knut@paranor.ch]
> > Sent: Tuesday, January 15, 2002 2:22 PM
> > To: 'Ant Users List'
> > Subject: RE: nested ${} expressions
> > 
> > 
> > I've requested this feature before aswell, and the answer is: 
> > you can't.
> > And it won't be part of Ant2 either; the proposal was submitted too
> > late.
> > Further it's been stated that it makes the buildfiles too 
> > complicated to
> > read.
> > 
> > You'll have to get by without nested properties or implement a new
> > <property> task... ;-(
> > 
> > --
> > knut
> > 
> > 
> > > -----Original Message-----
> > > From: Rahamim, Zvi (Zvi) [mailto:zrahamim@avaya.com]
> > > Sent: Dienstag, 15. Januar 2002 12:40
> > > To: Ant Users List
> > > Subject: nested ${} expressions
> > > 
> > > 
> > > Hi all !!!
> > > I have the properties:
> > > a=111
> > > b=222
> > > 111.222=x
> > > 
> > > I want to do something like:
> > > <echo message="${${a}.${b}}" />
> > > so that it will print 'x'.
> > > 
> > > How can I do it?
> > > 
> > > Thank you!
> > > 
> > > Zvi 
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > > <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail: 
> > > <mailto:ant-user-help@jakarta.apache.org>
> > > 
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: 
> > <mailto:ant-user-help@jakarta.apache.org>
> > 
> 
> --
> To unsubscribe, e-mail:   
<mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message