【问题标题】:Disable printing of stracktrace/ BuildException output in STS Gradle在 STS Gradle 中禁用 stracktrace/BuildException 输出的打印
【发布时间】:2016-08-24 06:53:05
【问题描述】:

目前我正在通过 Eclipse Neo 和 STS Gradle Plugin 运行 Gradle 2.x/3.x 版本。如果在构建时出现问题,例如在 compileJava 任务中,我得到了错误的详细信息(imo 在 eclipse 的控制台选项卡中打印到 stderr,然后还有一种用于发生的构建异常的堆栈跟踪(imo 在控制台选项卡中打印到 stdout)。

这是一个示例输出:

[sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks: 
[sts]      compileJava
[sts] -----------------------------------------------------
[...]
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or  --debug option to get more log output.
[sts] Build failed
org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.14-bin.zip'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:57)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at org.[...]

堆栈跟踪随 [sts] 一起提供,所以我认为它不是直接来自 Gradle。有没有办法抑制堆栈跟踪的打印?

【问题讨论】:

    标签: java eclipse spring gradle


    【解决方案1】:

    gradle STS 构建插件不提供禁用此堆栈跟踪打印的方法。
    这可以通过查看how this stack trace printing is implemented in the plugin source来验证。
    所有输出都发送到同一个打印流,没有日志框架或配置选项可以对打印内容进行精细控制。
    值得注意的是,该插件已被弃用(并且正在最低限度地维护)以支持buildship plugin
    buildship 插件没有表现出相同的堆栈跟踪打印行为。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-30
      • 1970-01-01
      • 2018-05-19
      相关资源
      最近更新 更多