You can deploy a war file using the following ant tasks - Read this first http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

1. You need to have the tomcat manager application available for the host. In Tomcat 6 and later it is like any other web application in ${catalina.base}/webapps. In Tomcat 5.5 it is configured by reference -- as context file manager.xml in ${catalina.base}/conf/Catalina/localhost pointing to ${catalina.home}/server/webapps/manager.

2. Add the catalina-ant.jar to your classpath... mine was in ${catalina.home}/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>


CategoryFAQ

AntDeploy (last edited 2011-07-29 22:58:19 by KonstantinKolinko)