Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant http doesn't fail target

Tags:

ant

I've been trying to get this to work all afternoon and can't. I want to verify that my app is up and running from my ant script. It seems that the below task should do the job but it doesn't. I've gone through the ant documentation with a fine tooth comb trying various permutations but the documentation is very scant in terms of catching a failure from http. Can anyone 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>
like image 304
Ian Jones Avatar asked Oct 08 '22 21:10

Ian Jones


1 Answers

The condition needs a <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 the not it will fail if the server is up.

like image 183
oers Avatar answered Oct 12 '22 11:10

oers