如何失败Phing而不触发回溯 [英] How to fail Phing without triggering backtrace

查看:151
本文介绍了如何失败Phing而不触发回溯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的主要的任务运行之前,它首先检查所有必需的属性是否被设置。如果一个属性丢失或无效,它会调用一个FailTask​​结束执行 - 这是有效的。

 < if> 
< equals arg1 =$ {build.db.host}arg2 =/>
< then>
< fail msg =build.db.host为空。 />
< / then>
< / if>

嗯,FailTask​​抛出一个BuildException(带有msg),它会在IfTask中抛出一个错误 - 这两个都显示了两次,其后跟,给我一个60行屏幕转储一行消息!



有没有办法抑制回溯,或者赶上(丢弃)例外?理想情况下,我会看到如下:

  BUILD FAILED 
/path/to/build.xml:728: 6:build.db.host为空
总时间:0.3351秒

我是运行最新版本的Phing,从Ubuntu 14.04的命令行。

解决方案

回溯已被清理为 http://www.phing.info/trac/ticket/1087 (将在版本中发布2.9.0)。感谢您的问题!


Before my main phing task runs, it first checks that all required properties have been set. If a property is missing or invalid, it calls a FailTask to end execution - which works.

<if>
  <equals arg1="${build.db.host}" arg2="" />
  <then>
    <fail msg="build.db.host is empty." />
  </then>
</if>

Alas, the FailTask throws a BuildException (with the msg), which throws an 'error in IfTask' - both of which are displayed twice, with their backtraces, giving me a 60-line screen dump for a one line message!

Is there a way to suppress the backtraces, or to catch (and discard) the exceptions? Ideally, I'd see something like:

BUILD FAILED
/path/to/build.xml:728:6: build.db.host is empty
Total time: 0.3351 seconds

I'm running the latest version of Phing, from the commandline in Ubuntu 14.04.

解决方案

The backtrace has been cleaned up as part of http://www.phing.info/trac/ticket/1087 (will be released in version 2.9.0). Thanks for the question!

这篇关于如何失败Phing而不触发回溯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆