ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: project.replaceProperties()
Date Wed, 30 Sep 2009 08:45:41 GMT
On 2009-09-30, Raja Nagendra Kumar <Nagendra.Raja@tejasoft.com> wrote:

> Stefan, you are correct.. We did make few modifcations to ant source and this
> has side effect else where..

> We are trying to support multiple property references resolutions with in a
> string some thing like this..

> Project p = getProject();
> p.setProperty("nagrama", "nagiest");
> p.setProperty("n", "nag");
> p.setProperty("m", "rama");
> p.replaceProperties("${${n}${m}}")//${${n}rama}

You will want Ant's trunk and a PropertyExpander like

http://svn.apache.org/viewvc/ant/sandbox/antlibs/props/trunk/src/main/org/apache/ant/props/NestedPropertyExpander.java

8-)

You can't have nested properties with Ant 1.7.1, but since you are
modifying Ant's source code anyway, you might as well switch to Ant's
trunk now - a release shouldn't be too far into the future.

> Pl. observe that there is misbehavior of replace properties.. i.e 2nd one
> gets replaced but not the first one..

No, there is not.  Ant parses ${} constructs by searching up to the next
closing brace, ignoring any newly opened ones by default.

${${n}${m}} is turned into

"value of property ${n" + "value of property m" + "literal }"

and since there is no property named "${n" it is expanded to ${${n}

Stefan

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


Mime
View raw message