Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Continue executing ant script if one task fails

Tags:

ant

I have an Ant script which runs tests then deploys my application to a QA server. To deploy the application it first calls sun-appserv undeploy, for various reasons the application may or may not be deployed. If the application is not deployed then undeploy fails and the whole script halts.

Is there some way that I can tolerate a failure on one task, log it, and let the rest of the script run?

like image 918
Freiheit Avatar asked Feb 23 '23 14:02

Freiheit


1 Answers

AntContrib try catch:

<trycatch>
<try>
   <!-- do deployment getting return code -->
</try>
<catch>
   <!-- echo the return code with a message -->
</catch>
</trycatch>

The exec task has a failonerror attribute which you can set to false to keep going.

like image 117
Adam Bruss Avatar answered Feb 28 '23 06:02

Adam Bruss