Gradle + Java 9 + JUnit 5

Hi Gradle!

Here is a small sample project that builds with Gradle on Java 9 using JUnit 5 for tests:

At the moment, I have to disable the default test task and have to inject a custom task like:

task testIceCreamMachine(type: Exec, dependsOn: compileTestJava) {
	executable = 'java'
	args = [
			'-Dscoops=' + System.getProperty('scoops', '3'),
			'--module-path', files(configurations.compileClasspath, configurations.testRuntimeClasspath, compileTestJava.destinationDir).asPath,
			'--add-modules', 'ALL-MODULE-PATH',
			'--module', 'org.junit.platform.console',
			'--reports-dir', "${buildDir}/test-results/junit-platform"

test.enabled = false
check.dependsOn testIceCreamMachine

Is it possible to avoid this extra task and re-configure the existing test task?

I tried to re-configure it like demonstrated by but I run into issues. Either “superClassName is empty!” or the build complains about closed pipes.