How about using the foreach task as you describe below but use a different
properties file for each server.
server1.properties
------------------
port=5000
server2.properties
------------------
port=6000
server3.properties
------------------
port=7000
build.properties
------------------
servers=server1,server2,server3
build.xml
------------------
...
...
-----Original Message-----
From: Naresh Bhatia [mailto:NBhatia@sapient.com]
Sent: Friday, March 07, 2003 1:11 PM
To: user@ant.apache.org
Subject: Deploying to multiple servers
I need to write an ant script to deploy to multiple servers. The number
of servers and their properties should be configurable.
For example, I may want to specify that
1) We need 3 servers: server1, server2 and server 3
2) The servers listen on ports 5000, 6000 and 7000
3) Each server needs a log4j.xml file that should be copied from a
template log4j.xml file, except that the log file name within this
template should be replaced with .log. For example,
server1.log.
What is the best way to do this? I started off by using Ant properties
and to loop through the servers, but my solution does not look
very elegant:
servers=server1,server2,server3
server1.port=5000
server2.port=6000
server3.port=7000
...
Thanks.
Naresh