bad option: '-target:jvm-11'

Hi.

I'm currently using Intellij IDEA Ultimate EAP (Build #IU-201.5616.10, Runtime version: 11.0.6+8-b722.15 x86_64) to write mixed scala + java code and building it with Gradle (see configuration on screenshot).

Version of gradle in gradle-wrapper.properties is 5.6.4, Java version is 11.0.6, Scala version is 2.12.10
I'm constantly getting:

Error:scalac: 'jvm-11' is not a valid choice for '-target'
Error:scalac: bad option: '-target:jvm-11'

 

How can I fix it?

9

The same crap when trying to run unit test in the module totally written in Kotlin (!)

0

Hi,
try to remove option "-target:XXX" from "Build, Execution, Deployment" -> "Scala compiler" -> "Additional compiler options" - leave it simply blank. Be sure to check all configuration variants.

Unfortunately, after reimporting gradle project, the option is resetted back but meanwhile the compilation should works.

1

> Unfortunately, after reimporting gradle project, the option is resetted back

It seems that:
- Idea is making up the 'target' parameter based on the 'targetCompatibility';
- this can be turned off by setting 'targetCompatibility' to an empty string.

tasks.withType(ScalaCompile) {
scalaCompileOptions.with {
targetCompatibility = ''
}
}

 

1

请先登录再写评论。