0

How can I set

idea {
    targetVersion = "13"
}

and

sourceCompatibility = 1.8

from the scala plugin https://docs.gradle.org/current/userguide/scala_plugin.html when building using the gradle kotlin dsl?

Zoltán
  • 21,321
  • 14
  • 93
  • 134
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292

1 Answers1

0

Setting the target version of IDEA is a simple copy-paste:

build.gradle:

idea {
    targetVersion = "13"
}

build.gradle.kts:

idea {
    targetVersion = "13"
}

Setting the sourceCompatibility is a bit trickier:

build.gradle:

sourceCompatibility = 1.8

build.gradle.kts:

 tasks.withType<ScalaCompile> {
     sourceCompatibility = "1.8"
 }

Do note however, that the Gradle Scala plugin docs state that the sourceCompatibility option is basically a no-op. The compatible Java version is determined by the Scala compiler, where 2.11.x targets Java 1.6, and 2.12.x targets Java 1.8

sa1nt
  • 356
  • 1
  • 4