我整个下午都在努力让它发挥作用,但做不到。我想从我的蚂蚁脚本中验证我的应用程序是否已启动并运行。下面的任务似乎应该完成任务,但它没有。我仔细地浏览了ant文档,尝试了各种排列,但在从http获取失败方面,文档非常少。有人能帮忙吗。有没有其他人让http和蚂蚁一起工作?
<?xml version="1.0" encoding="UTF-8"?>
<project name="hermes" default="test-app-running" xmlns:epam="epam://epam.com" xmlns:catalina="antlib://catalina.apache.org" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<target name="test-app-running" >
<waitfor maxwait="10" maxwaitunit="second">
<http url="http://localhost:8080/" />
</waitfor>
<fail message="App did not come up. Check your log files, fix and try again. Good Luck :-).">
<condition>
<http url="http://localhost:8080/" />
</condition>
</fail>
</target>
</project>
条件需要一个<not />
。我刚刚测试过它,它有效。
<fail message="App did not come up. Check your log files, fix and try again. Good Luck :-).">
<condition>
<not>
<http url="http://localhost:8080/" />
</not>
</condition>
</fail>
如果没有not,如果服务器启动,它将失败。