When I build my project from IntellijIdea I get the following errors
Error:scalac: 'jvm-11' is not a valid choice for '-target'
Error:scalac: bad option: '-target:jvm-11'
I am using gradle to build my project. My project is using java 11 and scala 2.12.8.
Can someone help me resolve this error?
Scala 2.12 doesn't support JVM 11 as a target. You need to add this to your gradle build file:
tasks.withType<ScalaCompile> {
targetCompatibility = "1.8"
}
As for Scala 2.13, the fix for this issue is:
tasks.withType<ScalaCompile>() {
targetCompatibility = ""
scalaCompileOptions.additionalParameters = listOf("-target:11")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With