ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim White <>
Subject RE: nested ${} expressions
Date Tue, 15 Jan 2002 17:43:10 GMT
At 04:20 PM 1/15/2002 +0200, Rahamim, Zvi (Zvi) wrote:
>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}"/>

There are two basic solution approaches.  Which one to use depends on 
exactly what your application is.

If the reason for the dynamic property names is that you have a 
nested/modular build, then I suggest breaking your build.xml file into two 
parts.  The second build.xml can have filter tokens in it, which you 
replace using the filter and copy tasks (or the style task if you prefer), 
then invoke with the ant task.

If that doesn't suit the style of your build, then use the script 
task.  Just setup the scripting engine (easiest to setup is probably Rhino 
for JavaScript).  Then you can say:

   <project name="myproject" ...
    <script language="javascript"><[CDATA[
        var c = myproject.getProperty("c");
        var d = myproject.getProperty(c);
        myproject.setProperty("d", d);


James P. White     Pagesmiths' home is
Live free
Try Kawa, the Java-based Scheme

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message