I have a java 11 project and I am trying to add a javaexec task to run a standalone cukedoctor documentation generation task, but it needs java 8 otherwise it errors unsupported Java version "11", defaulting to 1.7
.
Is there a way I can explicitly set the java version on a javaexec task that's different from the main project?
build.gradle
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
task cukeDoctor() {
group = "Documentation"
description = "Publish cucumber documentation and test results"
dependsOn test
doLast {
javaexec {
main = "-jar"
args = ['tools/cukedoctor-main-1.2.1.jar', '-p', 'docs/cucumber.json']
}
}
}