0
我知道这个任务应该模仿传统编程语言中try/catch的结构,但是我不能在我的生活中想出一个场景,其中<finally>
实际上在Ant脚本中很有用。ant-contrib的trycatch中“finally”元素的用途是什么?
例如:
<trycatch>
<try>
<copy file="foo.txt" todir="bar" />
</try>
<catch>
<echo message="could not copy" />
</catch>
<finally>
<echo message="all done" />
</finally>
</trycatch>
...在功能上等同于:
<trycatch>
<try>
<copy file="foo.txt" todir="bar" />
</try>
<catch>
<echo message="could not copy" />
</catch>
</trycatch>
<echo message="all done" />
蚂蚁引擎将会移动到下一行的trycatch块后完成后,有啥包括在其结尾处执行的代码块的要点?
参考:http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html