当使用 tomcat 管理器命令运行 Ant 目标时,它们似乎成功,但报告 BUILD FAILED。
以下是我的 build.xml 的相关部分:
<property name="path" value="/MyApp"/>
<property name="manager-url" value="http://localhost:8080/manager/html"/>
<property name="username" value="admin"/>
<property name="password" value=""/>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask"/>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/>
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/>
<target name="start" description="Start web application">
<start url="${manager-url}" username="${username}" password="${password}" path="${path}" output="${tomcat-home}/webapps/start.html"/>
</target>
<target name="stop" description="Stop web application">
<stop url="${manager-url}" username="${username}" password="${password}" path="${path}" output="${tomcat-home}/webapps/stop.html"/>
</target>
<target name="undeploy" description="Start web application">
<undeploy url="${manager-url}" username="${username}" password="${password}" path="${path}" output="${tomcat-home}/webapps/undeploy.html"/>
</target>
当我从 eclipse 运行这些目标(启动、停止、取消部署)时,我得到如下输出:
Buildfile: C:\eclipse_3.5\eclipse\workspace\MyApp\build.xml
Trying to override old definition of datatype resources
undeploy:
BUILD FAILED
C:\eclipse_3.5\eclipse\workspace\MyApp\build.xml:85: <html>
Total time: 20 seconds
目标重定向的输出是 html 文件,表明 Tomcat 管理器命令成功,当我检查管理器时,它似乎成功了。
最佳答案
我遇到了同样的问题并找到了答案 here
问题是您用于取消部署任务的 URL;您需要删除 html。
<property name="manager-url" value="http://localhost:8080/manager/html"/>
应该是:
<property name="manager-url" value="http://localhost:8080/manager"/>
关于eclipse - 为什么Ant Tomcat任务看似成功,Eclipse却报BUILD FAILED?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7408150/