ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From untz <>
Subject Problem running Undeploy Target in Tomcat 5.5.9
Date Fri, 08 Dec 2006 17:19:12 GMT
Hello there,

I am using JDK 1.5, Eclipse 3.2, and Tomcat 5.5.9. I wrote a build script which compiles,
packages (via war file) the source, deploys (moves the war into TOMCAT_HOME/webapps), and
is supposed to undeploy (by deleting the particular web app's directory & war file under

The problem that I am encountering is that while Tomcat is running, I have a lib directory:
TOMCAT_HOME/MyWebApp/WEB-INF/lib which contains several needed jar files. It seems that when
I run my Ant's undeploy target, it refuses to delete the lib directory and thus the build

Buildfile: C:\DevProjects\guess_number\build.xml
   [delete] Deleting directory C:\DevTools\tomcat\jakarta-tomcat-5.5.9\webapps\NumberGuess

C:\DevProjects\guess_number\build.xml:57: Unable to delete file C:\DevTools\tomcat\jakarta-tomcat-5.5.9\webapps\NumberGuess\WEB-INF\lib\Echo2_App.jar

Total time: 345 milliseconds

build script:
<?xml version="1.0"?>
<project name="NumberGuess" default="deploy" basedir=".">
    <property file=""/>

    <target name="prepare">
        <mkdir dir="${}" />
        <mkdir dir="${}/WEB-INF" />
        <mkdir dir="${}/WEB-INF/lib" />
        <mkdir dir="${}/WEB-INF/classes" />
    <target name="static" depends="prepare">
        <!-- Copy web files -->
        <copy todir="${}/">
            <fileset dir="web" />
        <!-- Copy webapp configuration files -->
        <copy todir="${}/WEB-INF/">
            <fileset dir="etc" />
        <!-- Copy library files -->
        <copy todir="${}/WEB-INF/lib/">
           <fileset dir="lib" />
        <!-- Copy images -->
        <copy todir="${}/WEB-INF/classes/echo2tutorial/">
            <fileset dir="images"/>
    <target name="compile" depends="static">
        <javac   srcdir="src"
                 deprecation="off" debug="on" optimize="off">
            <!-- Include all JAR files in my local library -->
            <fileset dir="lib">
                <include name="*.jar"/>
            <!-- Include all common libraries in Tomcat -->
            <fileset dir="${tomcat.home}/common/lib">
                <include name="*.jar"/>

    <target name="deploy" depends="compile">
        <jar jarfile="${build.dir}/${}.war" basedir="${}" />
        <!-- Copy the newly built WAR file into the deployment directory -->
        <copy file="${build.dir}/${}.war" todir="${tomcat.deployment.dir}" />
    <target name="undeploy">
        <!-- Delete the deployment directory -->
        <delete dir="${tomcat.deployment.dir}/${}" />
        <delete file="${tomcat.deployment.dir}/${}.war" />

    <target name="clean" 
            description="Clears all generated files, including build directories, distributables,
and documentation.">
        <delete dir="${build.dir}"/>

# Webapp properties for the project${build.dir}/${}

# Tomcat properties

When I manually shutdown Tomcat, I am able to run my undeploy target just fine... But I need
it to be able to undeploy while Tomcat is running.

Many, many thanks!


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message