scala - Gradle Kotlin DSL Scala和想法

标签 scala gradle kotlin gradle-kotlin-dsl

我该如何设定

idea {
    targetVersion = "13"
}


sourceCompatibility = 1.8

从scala插件https://docs.gradle.org/current/userguide/scala_plugin.html使用gradle kotlin dsl构建时?

最佳答案

设置IDEA的目标版本是一个简单的复制粘贴:
build.gradle:

idea {
    targetVersion = "13"
}

build.gradle.kts:
idea {
    targetVersion = "13"
}

设置sourceCompatibility有点棘手:
build.gradle:

sourceCompatibility = 1.8


build.gradle.kts:
 tasks.withType<ScalaCompile> {
     sourceCompatibility = "1.8"
 }

但是请注意,Gradle Scala plugin docs声明sourceCompatibility选项基本上是无操作的。兼容的Java版本由Scala编译器确定,其中2.11.x针对Java 1.6,而2.12.x针对Java 1.8

关于scala - Gradle Kotlin DSL Scala和想法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50541291/

相关文章:

java - 如何配置Jenkins,从本地到从机运行代码?

android - 有没有办法改变 Unity 中的 gradle.properties 文件

testing - 使用 Intellij 运行测试时为 "Test events were not received"

java - Kotlin如何使用JDK 1.8调用Java 11代码?

java - 使 sbt 重新编译受影响的 Java 源代码

java - 将 Scala Future 转化为 CompletableFuture

java - Maven 在 maven-remote-resources-plugin : Error finding remote resources manifests 上失败

scala -i 选项适用于 v2.9.0 但不适用于 v2.9.2

java - 梯度错误:Execution failed for task ':app:dexDebug' .

java - Gradle 项目构建成功,但 IntelliJ 无法解析引用