You can deploy a war file using the following ant tasks -
Read this first http://tomcat.apache.org/tomcat-5.0-doc/manager-howto.html
- You need to have the tomcat manager application available for the host - add a context manager.xml file
pointing to ${catalina.home}/server/webapps/manager, which should be installed by default
2. Add the catalina-ant.jar to your classpath... mine was in ${catalina.home}/server/lib
<taskdef resource="org/apache/catalina/ant/catalina.tasks" classpathref="your.class.path" /> <target name="tomcat.undeploy" > <undeploy url="${deploy.url}" failOnError="false" username="${deploy.user}" password="${deploy.pass}" path="${deploy.context}"/> </target> <target name="tomcat.deploy" > <deploy url="${deploy.url}" username="${deploy.user}" password="${deploy.pass}" path="${deploy.context}" war="file:${deploy.war}"/> </target> <target name="tomcat.start" > <start url="${deploy.url}" failOnError="false" username="${deploy.user}" password="${deploy.pass}" path="${deploy.context}"/> </target> <target name="tomcat.stop" > <stop url="${deploy.url}" failOnError="false" username="${deploy.user}" password="${deploy.pass}" path="${deploy.context}"/> </target>
See also http://raibledesigns.com/wiki/Wiki.jsp?page=TomcatAntTasks