ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Small <msm...@Clickability.com>
Subject How can I copy and replace in a file multiple times based on valu es in a loaded props file.
Date Thu, 14 Feb 2002 21:20:11 GMT

Does anybody have any suggestions on what I can do here. I think I can do
this with the script tag but I'd like to stay away from that. Could I do
this with a custom task maybe?

What I want to do is have ant generically read a dbNames property, and for
each name in that load a set of configuration params. For each name it would
copy a properties file into the final app and do the proper replacement.
Thus for each database I would have one database.properties file.

In the properties file read by ant:

dbNames=db1,db2

db1.dbUser=user1
db1.dbPassword=user1pwd
db1.dbServer=server1
db1.dbName=database1

db2.dbUser=user2
db2.dbPassword=user2pwd
db2.dbServer=server2
db2.dbName=database2

Then I have a database.properties file like this:

dbUser=@dbUser@
dbPassword=@dbPassword@
dbAlias=@dbServer@
dbURL=jdbc:informix-sqli://@dbServer@:4004/@dbName@:INFORMIXSERVER=@dbServer
@;user=@dbUser@;password=@dbPassword@

That would be replaces such that there would be two properties files in my
webapp, database_db1.properties and database_db2.properties. My app would
then know to setup two (or more) database connections.

Any suggestions are greatly appreciated.

Thanks

Matt

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message