ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Toens" <sto...@bea.com>
Subject RE: Using Ant to test whether a web app is installed on Tomcat
Date Mon, 22 Mar 2004 21:14:09 GMT
Hi Michael,

To check the property's value, you could do something like:

<condition property="bad-exit-code">
  <not><equals arg1="${resultprop}" arg2="0"/></not>
</condition>
<fail if="bad-exit-code" message="exec task returned with non-zero exit code"/>

(assuming resultprop has been set by the exec task)

Simon

-----Original Message-----
From: Michael Woinoski [mailto:michaelw@pineneedleconsulting.com]
Sent: Monday, March 22, 2004 11:43 AM
To: user@ant.apache.org
Subject: Using Ant to test whether a web app is installed on Tomcat


I'm using Ant 1.5 to develop and test web apps with Tomcat 5. I need a way to 
use an Ant task to determine whether a particular web app is installed.

Currently, my init task uses <available> to check the existence of a marker 
file. Then the build task tests the property set by <available>. If the marker 
file doesn't exist, the build task creates the marker file and installs the app. 
If the marker file exists, the build task reloads the app.

However, this simple scheme frequently fails because there are times when the 
marker file exists but the application failed to install. I need a way to make 
the test for a successful installation more reliable.

I thought about doing away with the marker file and instead using a Perl script 
that runs "ant list", searchs for the app context name in Ant's output, and sets 
a return code. But how do I test the return code in build.xml? The exec task 
supports a resultproperty attribute but I don't see a way to test the property's 
value.

Note: I need to use Ant 1.5 bundled with JWSDP, so Ant 1.6 features won't help.

Thanks,
Mike

-- 

Mike Woinoski                      Pine Needle Consulting
mailto:michaelw@pineneedleconsulting.com



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message