即使Ant任务失败,Ant也会成功
我一定缺少一个简单的设置,所以请原谅我,但我已经注意到有两次我糟糕的ant任务不会导致构建失败。例如:即使Ant任务失败,Ant也会成功,ant,Ant,我一定缺少一个简单的设置,所以请原谅我,但我已经注意到有两次我糟糕的ant任务不会导致构建失败。例如: 源文件不存在时的Ant复制。。。建设成功 Ant解压,当任务报告“无法写入文件”或类似消息时。。。建设成功 Ant exec错误,无效语法。。。建设成功 如何保证所有ant任务错误都会导致生成失败?您是否尝试过以下操作: <copy todir="your/path/details" failonerror="true"> </copy> <zip destfi
如何保证所有ant任务错误都会导致生成失败?您是否尝试过以下操作:
<copy todir="your/path/details" failonerror="true">
</copy>
<zip destfile="your/path/details" whenempty="fail">
</zip>
<exec executable="your/path/details" failonerror="true">
</exec>
默认情况下,任务不会失败。您需要使用failonerror=“true”
- Ant
任务的失败取决于所使用的资源收集类型。如果使用
或文件集
,则所有缺少的文件都会被自动忽略。只能通过使用模式集
类型或使用参数化的“file”属性来强制失败 因此,您想要使用的是:文件列表
<copy todir="my_dir" file="foo" /> <copy todir="my_dir" flatten="true"> <filelist dir="" files="foo" /> </copy> <copy todir="my_dir" flatten="true"> <filelist dir=""> <file name="foo" /> <file name="bar" /> <file name="zed" /> </filelist> </copy>