You can deploy a war file using the following ant tasks -
Read this first http://tomcat.apache.org/tomcat-57.0-doc/manager-howto.html
1. You need to have the tomcat manager application available for the host
...
pointing to . 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
, which should be installed by default}.
2. Add the catalina-ant.jar
to your classpath... mine was in {${catalina.home}
/server/lib
}
No Format |
---|
<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=TomcatAntTasksCategoryFAQ