Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@apache.org Received: (qmail 20370 invoked from network); 14 Feb 2002 23:51:08 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 14 Feb 2002 23:51:08 -0000 Received: (qmail 22021 invoked by uid 97); 14 Feb 2002 23:51:04 -0000 Delivered-To: qmlist-jakarta-archive-ant-user@jakarta.apache.org Received: (qmail 22004 invoked by uid 97); 14 Feb 2002 23:51:04 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 21993 invoked from network); 14 Feb 2002 23:51:03 -0000 Message-ID: <24946BD18054D4119BE200D0B73E87778D5F7B@BOROMIR> From: Matt Small To: 'Ant Users List' Subject: RE: 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 15:51:30 -0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Thanks for the response Diane. I really want to keep the databases indeterminate since I will be doing this for lots of different apps, so it looks like I am going to go with a custom task. Thanks again. Matt -----Original Message----- From: Diane Holt [mailto:holtdl@yahoo.com] Sent: Thursday, February 14, 2002 3:32 PM To: Ant Users List Subject: Re: How can I copy and replace in a file multiple times based on valu es in a loaded props file. --- Matt Small wrote: > 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? You can do just about anything with a custom task :) But if you'd rather stay away from that as well, then it depends on how indeterminate the number of DBs you want to do it for really is. > 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 In other words, rather than having this one file to hold all these values, why not put each in its own properties file? If you do that, and if you always want to include them all, then things get a bit more doable. But if you don't, then you'll most probably need to go with a script or custom task (or at least a couple of the available but non-standard ones, such as and ). > 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. Depends on whether you'd always want all the DBs that you have properties files for to go, or whether you want to be able to specify only certain ones. Diane ===== (holtdl@yahoo.com) __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: