ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Resolving of variables
Date Fri, 12 Jan 2001 15:49:48 GMT
Mariano Kamp <> wrote:

>   This parameter is passed to ant on the command line and everything
>   is working fine. The only problem is for launching the sql script
>   that I need to provide some parameters like the database url. In
>   ant I have the parameters defined like this:
>   <property name=""   .../>
>   <property name="db.postgres.url" .../>
> I don't have a clue about how to select one of these values at
> runtime. I pass in a parameter called db which holds for example
> "oracle". What I tried was:
>   <sql url="${db.${db}.driver}" ...../>
> Which isn't working ... Is there any alternative to solve my
> problem?

Yes there is.

First, what you do is not working because Ant doesn't recurse when
expanding properties.

Now to the alternative solution: 

Place the properties in an external file, something like

And in your buildfile use

<property file="${db}.properties" />
<sql url="${db.url}" driver="${db.driver}" ... />

and so on.


View raw message