ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <>
Subject Re: How to undeploy web application if it exists
Date Sun, 09 Dec 2007 03:13:24 GMT
Have another target called "_undeploy-test". This target will use test
whether or not the product is actually deployed. You can the
<condition> or <available> task to test whether or not your project is
deployed. The <available> task is defined here:
<>. The
<condition> task is described here:
<>. Supported
conditions are described here:

Next, have your <deploy> target depend upon the <undeploy> target.
This can be done via the "depends" parameter of your target.

Finally, set your <undeploy> task to depend upon the <_undeploy-test>
target. This target should set a property if the module is deployed.
Have the undeploy target depend upon this property be defined. Here's
an example layout:

<project name="foo" default="deploy" basedir=".">

<property name="deploy.dir" value="?"/>

    <target name=_undeploy-test">
        <available file="${deploy.dir}" type="dir"

   <target name="undeploy"
       <delete dir="${deploy.dir}"/>

   <target name="deploy"


Note that when you run the "deploy" target, it will first run the
"undeploy" target automatically. The "undeploy" target will
automatically run the "_undeploy-test" target first, if that target
doesn't set the "module.deployed" property, the "undeploy" target
won't execute. However, the "deploy" target will still run.

On Dec 8, 2007 9:39 PM, hezjing <> wrote:
> Hi
> How do I check if an web application already installed in Tomcat 5.5.x?
> I have a DeployTask and UndeployTask configured in build.xml, and I
> want Ant to undeploy the existing web application automatically before
> it deploys the new one.
> Currently, I have to run Ant with 2 targets like > ant undeploy deploy.
> This still cause problem when the application has been removed by
> someone else :-(
> --
> Hez
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

David Weintraub

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message