Migrate from Groovy to Java
Support Gradle 1.12

Do not update the build to 1.12 yet as IntelliJ 13.1.2 doesn't support it.

I tested the change by temporarily upgrading to 1.12 and checking that the
tests pass.