ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Nichele <stefano.nich...@gmail.com>
Subject Re: properties that start with ${..
Date Tue, 22 Jul 2008 15:02:18 GMT
By now I did a bsh method

void copyProperty(String src, String dest) {
    String srcValue = project.getProperty(src);
    project.setProperty(dest, srcValue);
}

and I call it with copyProperty("${car}", "car") so that I'm now able at 
least to access  to the value.

ste

Matt Benson wrote:
> --- Matt Benson <gudnabrsam@yahoo.com> wrote:
>
>   
>> You're in luck.  Maybe.  I tested the following:
>>
>>   <property name="$${foo}" value="foo" />
>>   <echo>${${foo}}</echo>
>>
>> and sure enough, it doesn't work.  This is not so
>> much
>> because it's no doable as it is because Ant's
>> property
>> parsing mechanisms don't know any better than to
>> match
>> the first encountered closing brace.  Running from
>> Ant's svn trunk with the 'props' sandbox antlib,
>> however, you can install the nested property
>> expander:
>>
>>   <propertyhelper>
>>     <nested xmlns="antlib:org.apache.ant.props" />
>>   </propertyhelper>
>>
>> This causes the original test to work.  The caveat
>> (beyond the fact that this is only available in an
>> unreleased version of Ant) is that if property 'foo'
>> were defined, ${${foo}} would resolve to the
>> expansion
>> of the expansion of the value of foo.  Actually it
>> should be possible to get around this by using
>> ${$${foo}}, but there seems to be something
>> preventing
>> this.  I'll look into that.
>>     
>
> As an update, there was a bug in the
> NestedPropertyExpander that related to $$ expansion. 
> I have fixed this; however the bad news is that that
> still won't help you because the "thinking the first
> encountered closing brace is the end" problem still
> applies once the internal $$ has been skipped (the
> subsequent { is not recognized as part of a nested
> property so the next } is seen as closing the outer
> property).  It might be possible to introduce some
> other mechanism to recognize delimited strings, but
> I'd have to think more about that.
>
> -Matt
>
>   
>> HTH,
>> Matt
>>
>> --- Stefano Nichele <stefano.nichele@gmail.com>
>> wrote:
>>
>>     
>>> Hi all,
>>> I have a property with name ${car}. Note that the
>>> name is  not just 
>>> "car"  but ${car}.
>>>
>>> Using echoproperties I see:
>>> [echoproperties] ant.version=Apache Ant version
>>> 1.6.5 compiled on June 2 
>>> 2005
>>> [echoproperties] ${car}=fiat
>>>
>>> How to handle that property ? How to do something
>>> like:
>>>
>>> <echo message="My car: ${car}" />
>>>
>>> since that one doesn't work. Conceptually it
>>>       
>> should
>>     
>>> be <echo message="My 
>>> car: ${${car}}" /> but it doesn't work.
>>>
>>> Thanks a lot
>>> ste
>>>
>>>
>>>       
> ---------------------------------------------------------------------
>   
>>> 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
>>
>>
>>     
>
>
>
>       
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   


-- 
Stefano Nichele

Funambol Servers Tech Lead
funambol :: mobile open source :: http://www.funambol.com


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


Mime
View raw message