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