我一直在努力使它整个下午都能正常工作。我想通过我的ant脚本验证我的应用程序已启动并正在运行。似乎下面的任务应该可以完成任务,但事实并非如此。我已经用一把细齿梳仔细浏览了ant文档,尝试了各种排列,但是从http捕获失败方面,该文档很少。谁能帮忙。还有其他人可以与ant一起使用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>

否则,如果服务器启动,它将失败。

10-01 04:47
查看更多