Mariano Kamp <[EMAIL PROTECTED]> 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="db.oracle.url" .../>
> <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
oracle.properties:
------------------
db.driver=...
db.url=...
postgres.properties:
------------------
db.driver=...
db.url=...
And in your buildfile use
<property file="${db}.properties" />
...
<sql url="${db.url}" driver="${db.driver}" ... />
and so on.
Stefan