We have a properties file per server and we pass in a property to the command line as we run the "deploy" target. So :
to run deploy to blah server : >ant deploy -Dhost=blah then our deploy target looks like as below <target name="host_properties" if="host" description="get the properties for the host being deployed to" > <property file="${build}/version.properties"/> <property file="${build}/hosts/${host}.properties"/> </target> <target name="deploy" depends="host_properties" if="host" unless="ssh"> <ftp server="${host.server}" userid="${host.userid}" password="${host.password}" remotedir="${host.jrun.rootdir}/servers" depends="yes" action="send" binary="yes" verbose="yes" > <fileset dir="${build}" includes="morganactive-${version}.jar"/> </ftp> <ftp server="${host.server}" userid="${host.userid}" password="${host.password}" remotedir="${host.jrun.rootdir}/servers/script" depends="yes" action="send" binary="no" verbose="yes" > <fileset dir="${build}/script" includes="**/*"/> </ftp> <telnet server="${host.server}" userid="${host.userid}" password="${host.password}"> <write>csh</write> <write>set prompt = 'ANT-READY'</write> <read>ANT-READY</read> <write>unalias cd</write> <read>ANT-READY</read> <write>cd /export/opt/jrun/servers</write> <read>ANT-READY</read> <write>chmod a+x script/*</write> <read>ANT-READY</read> <write string="script/install ${host.jrun.servername} morganactive-${version} ${host.local.properties.suffix}"/> <read>ANT-READY</read> </telnet> </target> and the ${build}/hosts/blah.properties looks like this host.server=blahserver1 host.userid=blahuser host.password=blahpass host.local.properties.suffix=dev host.jrun.rootdir=/root/blah/blah host.jrun.servername=blah [EMAIL PROTECTED] on 22/02/2002 16:13:26 Please respond to "Ant Users List" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: Subject: Deploying to web server Our Java source code (and ant buildfiles) are archived centrally and pulled down onto various machines using CVS. One thing we'd like to be able to do is to deploy .wars and .ears to the appropriate web server or EJB server once they've been built. However, the location of the web server/EJB server will vary from machine to machine --- and even between different servers on the same machine (one time I may want to deploy to WebSphere, another time to IPlanet). One idea we have for dealing with this issue is to define environment variables such as $IPLANETDIR and $WEBSPHEREDIR on each machine, and letting the wrapper script for ant pick up those values and pass them to ant. This will work, but it requires the introduction and maintenance of several (and looking into the future, perhaps MANY) environment variables, which we're not crazy about. Nor are we crazy about the prospect of keeping the ant wrapper up to date with all of the environment variables. Another suggestion is a two-step process, which would have ant deliver all .wars and .ears to some "canonical" location on each machine (and yet to be determined --- 'java.io.tmpdir'?). The actual deployment to the web server/EJB server would happen in a second step, probably without the help of ant. How do others deal with this issue? Thanks, --dave -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>