I'd like to hook into the compileJava target and spit out an additional custom message on failure. We've got a really common case setup case that a lot of folks overlook and it'd be useful, only on failure, to be able to do something like:
compileJava.onFailure {
println "Did you configure your wampfrankle to talk to the slackometer?"
}
My Google skills have not yet led to an answer.
The error is a dependency error and as Rene points out that needs to be detected after the build has executed, not after the project has been evaluated.
Here I've added a call to buildFinished with a closure that detects if a failure has happened and prints out an error message.
project.gradle.buildFinished { buildResult ->
if (buildResult.getFailure() != null) {
println "Did you configure your wampfrankle to talk to the slackometer?"
}
}
To test this I force a dependency resolution failure with this bogus dependency:
dependencies {
compile 'foo:bar:baz'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With