Gradle: custom message on task failure? -
I want to hook into the compileJava target and impose an additional custom message on the failure. We have a really common case setup case, which many people ignore and it would be helpful, only to fail, to be able to do this:
compileJava.onFailure {println "Did you configure your wampfrankle to talk to the slaker?" }
My Google skills have not responded yet.
The error is a dependency error and Reine explains that after the execution of the build, After evaluation has not been done.
Here I have added a call to add, which has ended with a failure that has been a failure and prints an error message.
project.gradle.buildFinished {buildResult -> If (buildResult.getFailure ()! = Null) {println "Did you configure your wampfrankle to talk to the slaker?" }}
To force this test, I force a dependency motion failure with this fake dependency:
dependency {compile 'foo: bar : Baz '}
Comments
Post a Comment