To reproduce: introduce a typo in the web-app/servlet-mapping/servlet-name element of a web.xml of a working app, so that a url-pattern is mapped to an undefined servlet. Run "ant install". Although Ant reports a successful build, there will be a number of exceptions reported in catalina.out (including "IllegalArgumentException: Servlet mapping specifies an unknown servlet name ..."), and the webapp won't work. Attempts to undeploy the broken web-app using "ant remove" or the HTML manager then fail, with complaints that the app hasn't been started ("LifecycleException"). The commands "ant install" and "ant reload" also fail, reporting that the "Application already exists at path ..." and "[app] has not been started", respectively. It seems the only way out is to delete the webapp from the filesystem by hand. I expect it should not be possible to partially deploy a webapp, even if it is misconfigured. Either the deployTask should delete from webapps an app that couldn't be started, or the UndeployTask should allow such an app to be removed. I am using Ant 1.6.2. My build.xml and web.xml closely resemble the examples given in the documentation.
I'll look at it, but using deploy and undeploy. install and remove are deprecated and unsupported.
undeploy had a defect in this case, so I fixed it. remove will now simply call undeploy. install already calls deploy.
*** Bug 32831 has been marked as a duplicate of this bug. ***