Ant http does not fail

I tried to get this to work all day and can't. I want to check if my application works with my ant script. It seems that below the task should do this work, but it is not. I looked at the ant documentation with a thin tooth comb that tried various permutations, but the documentation is very scarce in terms of detecting failure with http. Can someone help. Has anyone else got http working with ant ok?

<?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>
+5
source share
1 answer

The condition needs <not />. I just tested it and it works.

<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>

Without it, it will not work if the server is busy.

+4
source

All Articles