Rework of Gradle build

It seems there is still an issue with invokedynamic. I can't figure out if it's a bug in the JDK, a bug in Groovy or a side effect of classloading with Gradle...

Starting with this PR to figure out how it behaves on the CI server.