Registering Events for the java runtime configuration can result in the wrong Exception.
This can make it very difficult to find the actual problem.
The code below reproduces this effect nicely.
build.gradle:
apply plugin: 'java'
configurations.runtime.allDependencies.all {
throw Exception('Some horrible Exception')
}
dependencies {
compile 'blub:blub:blub'
}
This results in:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\...\build.gradle' line: 8
* What went wrong:
A problem occurred evaluating root project 'GradleBug'.
> Could not find method compile() for arguments [blub:blub:blub] on root project 'GradleBug'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The ‘blub:blub:blub’ is only a placeholder. Any valid dependency will give you the same message.