我有一个运行测试的Ant脚本,然后将我的应用程序部署到QA服务器.要部署它首先调用的应用程序sun-appserv undeploy,由于各种原因,可能会或可能不会部署应用程序.如果未部署应用程序,则取消部署失败,整个脚本停止.
有什么方法可以容忍一个任务的失败,记录它,让脚本的其余部分运行?
AntContrib试试catch:
<trycatch>
<try>
<!-- do deployment getting return code -->
</try>
<catch>
<!-- echo the return code with a message -->
</catch>
</trycatch>
Run Code Online (Sandbox Code Playgroud)
exec任务有一个failonerror属性,您可以将其设置为false以继续运行.