Shammer's Philosophy

My private adversaria

Using Tomcat Deployer via ant

  1. Download Tomcat Deployer from Apache Site
  2. Expand Deployer's tar.gz file anywhere you like(call the directory tomcat.deployer.dir)
  3. Generate build.xml
  4. Add following element to build.xml
<!-- Tomcat classpath --> 
<path id="classpath.tomcat"> 
  <fileset dir="${topmcat.dir}/lib/"> 
    <include name="*.jar" /> 
  </fileset> 
</path> 
<!-- Tomcat Deployer classpath --> 
<path id="classpath.tomcat-deployer"> 
  <fileset dir="${tomcat.deployer.dir}"> 
    <include name="*.jar" /> 
  </fileset> 
</path>
<!-- Custom Ant Task --> 
  <taskdef resource="org/apache/catalina/ant/catalina.tasks" classpathref="classpath.tomcat-deployer" />
<!-- Deployer --> 
<target name="deploy"> 
  <undeploy url="${url}" username="${username}" password="${password}" path="${context}" failOnError="false" /> 
  <deploy url="${url}" username="${username}" password="${password}" path="${context}" war="${appName}.war" update="true" /> 
</target>
<!-- compile -->
<target name="compile" depends="cleanup">
  <javac srcdir="${dir.src}" destdir="${dir.classes}" executable="${compiler}" includeantruntime="false">
    <classpath refid="classpath.tomcat" />
  </javac>
</target>