Post Build Failure message?


(Mike Snare) #1

Is there anything available to support a final message output when the build fails?

I keep fielding requests from people that didn’t pay attention the last time I answered these questions:

  1. My build failed. What do I do?
  2. How do I get the build scan from the last build?
  3. How do I do a full rebuild with clean and re-deploy?
  4. How do I ensure tasks rerun?

As these are standard questions, it’d be nice if I could just dump them at the very end of the build once we know that the build has failed.

I use parallel builds so a failed task may have completed some time ago and its messages may have scrolled off the screen if another longer running task is still going, so I don’t think a task listener will do. I’m looking for something for the entire build, not a task. Does anything like this exist?


(James Justinic) #2

When your build has failed and TaskListener doesn’t look good, who you going to call?

BuildListener - https://docs.gradle.org/4.0/javadoc/org/gradle/BuildListener.html

Implement/extend the listener/adapter for the buildFinished callback or use the buildFinished method to provide an Action or Closure via the Gradle object.


(Mike Snare) #3

I’m mostly just ashamed that I couldn’t find that myself. Not sure how I missed it. Thanks!