How to fail Phing without triggering backtrace

我只是一个虾纸丫 提交于 2019-12-11 03:23:55

问题


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.


回答1:


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!



来源:https://stackoverflow.com/questions/25663869/how-to-fail-phing-without-triggering-backtrace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!