ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From untz <untz...@yahoo.com>
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
TOMCAT_HOME/webapps).

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
breaks:

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

BUILD FAILED
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="build.properties"/>

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

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

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

build.properties:

project.name=NumberGuess
build.dir=./build

# Webapp properties for the project
webapp.name=NumberGuess
webapp.build.dir=${build.dir}/${webapp.name}
webapp.virtual.host=localhost

# Tomcat properties
tomcat.home=C:/DevTools/tomcat/jakarta-tomcat-5.5.9
tomcat.deployment.dir=${tomcat.home}/webapps

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!

-Unnsse


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