Announcement Announcement Module
No announcement yet.
Gradle Plugin - turn off stacktraces for failed tests Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gradle Plugin - turn off stacktraces for failed tests


    i'm using Eclipse Juno with the Gradle-Plugin for a new project. Everything went smooth so far but there's one issue that is annoying. When i start the test task in my project and a test fails, i get a complete stacktrace in the console. You have to scroll up to the very top to see which test fails.
    I've already tried to configure the test-task in my build.gradle (showStackTraces false), but without success. Is there a way to suppress those stacktraces ?

    best regards

  • #2
    I've also noticed that running gradle tasks via the tooling rather than from commandline shows the stacktraces. Whereas on the commandline I think you have to add a special commandline option to get the traces.

    It didn't really bother me, (usually it bothers me more if I want/need the traces and have to do something special to turn them on).
    But I can see how this can be annoying as the traces are indeed rather lenghty and verbose.

    I'm not sure if there's a way to turn them off. I'll look into it a little and post back here later if I find something interesting.



    • #3
      Unfortunately it looks like this is may be impossible or at least rather hard to turn off.

      Good news:
      a) STS-Gradle has a mechanism to pass commandline style options to Gradle task executions. (after you launch the tests from within STS by running the tests task, you can edit the corresponding launch config via the "External Tools..." menu accessible by clicking toolbar button with the little suitcase and 'play button' icon. Go to the 'Arguments' tab of the launch config for your test task.
      b) Gradle has options to control stacktrace logging / verbosity:

      Bad news:

      I tried to set -q or --quiet options there but they didn't supress the stacktraces as I would expect.

      My guess is that the tooling API is probably overriding the option because, normally, if nothing is specified it should not be printing verbose traces. This is why I think the tooling API is probably forcing the verbose traces no matter what is being passed.

      We should probably raise this as a bug with Gradle via the Gradle forum or bug tracker.

      The Gradle logging documentation in the Gradle user guide also talks about 'implementing your onw logging'. Maybe that is a way to control more directly how/what gets logged. But I didn't try this as it seems a bit to involved for a quick experiment right now.

      Conclusion: I don't think there's an easy way to disable the traces. But it may be a good idea if we follow up on this at the Gradle forum as it seems setting '--quiet' commandline switch *should* supress the traces but it doesn't and that's really a Gradle bug.



      • #4
        Gradle forum issue that seems similar / related.


        • #5
          Hi Kris,

          thank you very much for your effort and your detailed answer. It was a good idea to post this issue on the Gradle Community Forum - Adam Murdoch mentioned in his reply to your post that the stacktraces will be gone in Gradle 1.6. Good news to me