Building Java 8 apps with Gradle

Sun, Dec 29, 2013 One-minute read

If you try to build your java-app with gradle against JDK8,and you error out on the tests being run, then this is most likely due to Gradle using ASM4.x for test-detection.

This has been fixed in Gradle 1.10 by using ASM5-beta to scan for tests, instead of 4.x as used in previous versions.

If you are unable to upgrade to Gradle 1.10 for some reason, you can apply the following trick to skip the scanning of tests, and just include them manually.

test.scanForTestClasses = false
test {
    include 'api/**/*Test.class'
    include 'service/**/Test*.class'
    exclude '**/*$*.class' // exclude anonymous inner classes
}