Here is what I do:

    <target
        name="deploy-context"
        description="Reload the given context">
        <fail unless="tomcat.username">Undefined: tomcat.username</fail>
        <fail unless="tomcat.password">Undefined: tomcat.password</fail>
        <fail unless="tomcatURL">Undefined: tomcatURL</fail>
        <echo taskname="deploy-context">
Deploying ${basedir}/${project.war} to ${tomcatURL}
        </echo>
        <undeploy
            failonerror="false"
            taskname="deploy-context"
            username="${tomcat.username}"
            password="${tomcat.password}"
            url     ="${tomcatURL}"
            path    ="/"/>
        <deploy
            taskname="deploy-context"
            username="${tomcat.username}"
            password="${tomcat.password}"
            url     ="${tomcatURL}"
            path    ="/"
            war     ="file:${basedir}/${project.war}"/>
    </target>

The key is failonerror="false" for the undeploy task.

Tim


-----Original Message-----
From: William Press [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 31, 2006 7:41 PM
To: users@tomcat.apache.org
Subject: Redeploying a war file from a build script

I am writing a build script that would redeploy a war file at the end of
the build.

 

If I use DeployTask and the application was already deployed from a
previous build, I get an error.

 

If I use UndeployTask first and the application is not already deployed
(which would happen the first time somebody runs the script on their
machine or if there's a failure between calls to UndeployTask and
DeployTask), I get an error.

 

I would like the script to be robust enough that it doesn't require the
user to do more than install Tomcat (and my distro, natch) on their
machine.

 

I thought ListTask useful, here, but I've read through the docs and
could not figure out how to capture the output for parsing (so I could
check whether this particular application is already deployed).

 

Any thoughts would be helpful,

Bill



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to