Execute a default task in ANT in case of failure

I'm currently using ANT for building my Java project on a Windows XP machine. In my build.xml file I've defined 3 task and I would like that,in case of fail,a default task be executed before closing the building and exiting (like a recovery procedure). I would like to know if it's possible.

thanks


Googled and found this. It's basically a try/catch for Ant. Might be worth a look: http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html


Never heard of such a property/task, but the follwing just comes to my mind: you could use an additional 'Master' ant script.

  • The master script (a new one) includes all public targets from the original one and delegates the work to the corresponding task in your build script (ant calls)
  • If the delegate fails, the master should be able to recognize the failure and could call the 'clean-up' task (either on the 'master' or on the original build file)
  • 链接地址: http://www.djcxy.com/p/1176.html

    上一篇: 在.NET中使用证书验证SQL连接

    下一篇: 如果发生故障,请在ANT中执行默认任务