You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Naresh Bhatia <NB...@sapient.com> on 2003/03/07 22:10:40 UTC

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

Re: Deploying to multiple servers

Posted by Mike McNally <m5...@works.com>.
> I need to write an ant script to deploy to multiple servers. The number
> of servers and their properties should be configurable.

I'm finding that using XSL to translate a smaller XML build spec
into an Ant build XML file works wonders for such special purposes.
You don't have to do anything icky in Ant.  All you maintain is
the translating stylesheet that captures the Ant targets/tasks 
you want to generate based on your needs.  Your Ant build then
has a target that runs <xslt> to generate the output build file
from your smaller spec file, and then uses <ant> to call a target
in that generated file.


--
[ you are my main foo ] Mike McNally -- m5@works.com