ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob H - VSCM" <Anderson....@vectorscm.com>
Subject RE: Deploying to multiple servers
Date Fri, 07 Mar 2003 21:51:04 GMT
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
------------------
<property file="build.properties"/>
<target name="deploy">
      <foreach list="${servers}" param="server" target="doit"
inheritall="true"/>
</target>

<target name="doit">
	<property file="${server}.properties"/>
	...
	...
</target>

-----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 <server-name>.log. For example,
server1.log.

What is the best way to do this? I started off by using Ant properties
and <foreach> 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

Mime
View raw message