ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: deploy by ant
Date Fri, 12 May 2006 09:59:46 GMT
Raghuveer wrote:
> My customer requirement is to use ANT.
> i.e
> -	Application must use ANT to build and deploy
> I have written build.xml for build.
> What does "deploy" means.

"deployment" is the act of getting your program up and running on the 

It could mean

1. to get your war file to the remote site and in the directory of the 
app server

use scp, ssh, copy,

   <!-- SCP logic from JDwA, core-chapter-08.xml -->

     init file should look like

     the secure/ dir should not be readable by group; in windows lock it 
   <target name="ssh-init" depends="init">
     <fail unless="server">Set the "server" property!</fail>
     <property name="ssh.propfile"
     <loadproperties srcFile="${ssh.propfile}"/>
     <property name="tmp.dir" location="${build.dir}/tmp"/>
     <mkdir dir="${tmp.dir}"/>
     <presetdef name="ssh-cmd">
       <sshexec host="${ssh.server}"
     <presetdef name="ssh-cp">

   <target name="ssh-mkdirs" depends="ssh-init">
     <ssh-cmd command="mkdir -p ${ssh.dir}/bin"/>
     <ssh-cmd command="mkdir -p ${ssh.dir}/lib"/>

   <target name="ssh-prepare-files" depends="install">
     <fileset id="ssh.fileset" dir="${install.dir}" includes="*.jar"/>

   <!-- insert trust="true" to turn on trust -->
   <target name="scp-upload" 
     <echo>SCP target is ${ssh.server}</echo>
     <property name="ssh.path"
     <!--copy the binaries-->
     <ssh-cp remoteToDir="${ssh.path}/lib">
       <fileset refid="ssh.fileset"/>
     <ssh-cp remoteToDir="${ssh.path}/bin">
       <fileset dir="hosts/${server}" includes="default.*"/>


   <target name="ssh-stop" depends="ssh-init">
     <ssh-cmd command="cd ${ssh.dir}; nohup ./sfStopDaemon localhost &amp;"

   <target name="ssh-start" depends="ssh-init">
     <ssh-cmd command="cd ${ssh.dir}; nohup ./sfStartDaemon &amp;"/>

   <target name="scp" depends="scp-upload,ssh-start"
       description="upload the files"/> configure the app server and the database correctly with the app 
running inside

   You can look at cargo from to do this

3. to scp up the the files then configure the app server and the 
database correctly with the app running inside on a remote box somewhere 
beyond your own firewall.

This is actually what happens in the example in (1), with the 
server-side workflow all handled by the smartfrog runtime:

This is not a trivial exercise, but, being automated, means I can roll 
out deployments to my home server from work, bring up the app server 
with the soap stack, have log4j route the output to a logs/ directory 
that one servlet context actually publishes, letting people remotely do 
it. Then we deploy a set of junit tests against that endpoint and three 
others on a different box and do real long haul testing of a SOAP endpoint.

> How can be done the same using ANT.

It depends entirely what you want to do. I think the key goal of the 
(fairly minimal) requirements are that there is some target
	ant deploy
That will get your WAR or EAR file up to the server and into the right 
directory. If the app server (like jboss) has hot deployment of copied 
files, that is enough for a live redeploy. Though I prefer to use catcus 
as cold starts are cleaner.

However, as deployment varies with each project, there is no one 
<deploy> task that does your work.

I will leave you with one warning. Getting deployment right is hard. 
Start now, not a week before you go live.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message