即使Ant任务失败,Ant也会成功

编程入门 行业动态 更新时间:2024-10-19 18:18:33
本文介绍了即使Ant任务失败,Ant也会成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我必须缺少一个简单的设置,请原谅,但我有两次注意到我的糟糕的ant任务不会导致构建失败.例如:

There must be a simple setting I am missing so forgive me, but I've noticed on two occasions that my bad ant tasks do not cause the build to fail. For example:

  • 源文件不存在时的蚂蚁副本...成功建立

  • Ant copy when source file does not exist ... BUILD SUCCESSFUL

    当任务报告无法写入文件"或类似消息时,蚂蚁会解压缩……构建成功

    Ant unzip, when task reports "can't write file" or similar message ... BUILD SUCCESSFUL

    Ant exec错误,语法无效...成功建立

    Ant exec error, invalid syntax ... BUILD SUCCESSFUL

    如何保证所有蚂蚁任务错误都会导致构建失败?

    推荐答案

      默认情况下,
    • <EXEC>任务不会失败.您需要使用failonerror="true"

      • <EXEC> tasks do no fail by default. You need to enable this with failonerror="true"

        Ant <COPY>任务的失败取决于所使用的资源收集类型.如果使用fileset或patternset,则所有丢失的文件都会被静默忽略.您只能通过使用filelist类型或使用参数化的'file`属性来强制失败.

        Failure of the Ant <COPY> task depends on what resource collection type is used. If you use a fileset or patternset, then all missing files are silently ignored. You can force a failure only by using the filelist type or the parameterized 'file` attribute is used.

        因此,您要使用的是:

        <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>

  • 更多推荐

    即使Ant任务失败,Ant也会成功

    本文发布于:2023-11-13 00:21:39,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1582893.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:也会   Ant

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!