ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: properties that start with ${..
Date Tue, 22 Jul 2008 13:15:36 GMT
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.

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


Mime
View raw message