subant failonerror微妙之处 [英] subant failonerror subtleties
问题描述
我有蚂蚁code揭开序幕发布版本中所有子目录:
I have ant code that kicks off a release build in all subdirectories:
<target name="all-release" >
<subant target="sub-release" failonerror="true">
<fileset dir="." includes="*/build.xml" />
</subant>
</target>
由于写的,如果有个别构建失败,所有的释放将失败快(没有后来的构建将取得成功。如果我切换failonerror =false时,所有的释放将接替所有的时间。事实证明,所有的子版本是独立的,所以我真正想要的是:
As written, if any individual build fails, all-release will fail fast (none of the later builds will succeed. If I switch failonerror="false", the all-release will succeed all the time. It turns out that all the sub-builds are independent, so what I really want is:
运行所有子发布版本,然后都释放失败之后,如果一个或多个子版本失败(最好有哪些未能建立一个很好的错误消息)。
run all sub-release builds, and then have all-release fail afterwards if one or more sub-releases failed (ideally with a nice error message about which builds failed).
任何想法?
推荐答案
建议你看看扩展可用在蚂蚁的contrib 任务。
Suggest you look at the extensions available in the ant-contrib tasks.
在'为'任务大概可以调整,以满足您的要求。
The 'for' task can probably be adapted to meet your requirements.
您全释的目标,与蚂蚁的contrib的taskdef可能是这样的:
Your 'all-release' target, with the ant-contrib taskdef might look like this:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<target name="all-release">
<for keepgoing="true" param="file">
<path>
<fileset dir="." includes="*/build.xml" />
</path>
<sequential>
<ant antfile="@{file}" target="sub-release" />
</sequential>
</for>
</target>
使用其它一些蚂蚁的contrib特征有可能获得该列表的失败。
Using some other ant-contrib features it may be possible to get the list of fails.
示例日志从上面的build.xml:
Sample log from above build.xml:
$ ant all-release
Buildfile: build.xml
all-release:
[echo] /work/Scratch/dir1/build.xml
sub-release:
[echo] dir1
[echo] /work/Scratch/dir2/build.xml
sub-release:
[echo] dir2
[for] /work/Scratch/dir2/build.xml: The following error occurred while executing this line:
[for] /work/Scratch/build.xml:17: The following error occurred while executing this line:
[for] /work/Scratch/dir2/build.xml:6: dir2 failed
[echo] /work/Scratch/dir3/build.xml
sub-release:
[echo] dir3
BUILD FAILED
/work/Scratch/build.xml:11: Keepgoing execution: 1 of 3 iterations failed.
Total time: 0 seconds
这篇关于subant failonerror微妙之处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!