Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

deploying webapps from ant

Keith Hankin

2004-04-24

Replies:

I am trying to deploy my webapps from ant, however my undeploy task does
not always work. It quietly informs me that everything is ok, however
the webapps subdirectory still exists, with at least some of the files
still there. Tomcat appears to be holding onto locks on the files and
they cannot be deleted. This is with both Tomcat 4 and Tomcat 5, running
on Windows XP. Here is my ant code showing my undeploy task:

  <target name="webapp.check">
    <fail unless="tomcat.url"
        message="tomcat.url is not specified in local.properties
file."/>
    <fail unless="tomcat.manager.url"
        message="tomcat.manager.url is not specified in
local.properties file."/>
    <fail unless="tomcat.manager.username"
        message="tomcat.manager.username is not specified in
local.properties file."/>
    <fail unless="tomcat.manager.password"
        message="tomcat.manager.password is not specified in
local.properties file."/>
    <condition property="tomcat.is.started">
       <http url="${tomcat.url}"/>
    </condition>
    <condition property="webapp.is.deployed">
       <and>
          <isset property="tomcat.is.started"/>
          <http url="${tomcat.url}/${ant.project.name}"/>
       </and>
    </condition>
  </target>
 
  <target name="undeploy" depends="webapp.check" if="webapp.is.deployed">
    <taskdef name="remove"
classname="org.apache.catalina.ant.RemoveTask">
       <classpath>
          <path location="${tomcatHome}/server/lib/catalina-ant.jar"/>
       </classpath>
    </taskdef>
    <remove url="${tomcat.manager.url}"
          username="${tomcat.manager.username}"
          password="${tomcat.manager.password}"
          path="/${ant.project.name}"/>
  </target>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.