While core support is being discussed in #19487, I came up with this hand-crafted task set, that makes the default test task depend on a test plan execution.
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
configurations {
jupiter
}
dependencies {
jupiter 'org.junit.platform:junit-platform-console:1.0.0-SNAPSHOT'
jupiter 'org.junit.jupiter:junit-jupiter-engine:5.0.0-SNAPSHOT'
}
task downloadJupiter(type: Copy) {
from configurations.jupiter
into "$buildDir/jupiter"
}
task runJupiter(type: JavaExec) {
jvmArgs '-ea'
classpath = project.sourceSets.test.runtimeClasspath + fileTree(dir: "$buildDir/jupiter", include: '*.jar')
main 'org.junit.platform.console.ConsoleLauncher'
args '--scan-class-path'
args "--reports-dir=$buildDir/jupiter-results"
}
runJupiter.dependsOn downloadJupiter
test.dependsOn runJupiter
Maybe, somebody finds it useful and can improve this work-around. Thanks for feedback.