我正在尝试编译简单的 Kotlin Gradle 脚本。我在 Idea 中使用 build.gradle.kts 创建了一个项目,内容如下:
group = "org.example"
version = "1.0-SNAPSHOT"
tasks {
register("runScript", Copy::class) {
from("data")
into("out")
}
}
它的灵感来自 gradle/kotlin-dsl 存储库中的复制示例,它既不是从 IDE 也不是终端中的 gradlew 编译。它给了我这些错误:
e: /Users/dalexiv/Workspace/script-zipper/build.gradle.kts:5:5: Unresolved reference: register
e: /Users/dalexiv/Workspace/script-zipper/build.gradle.kts:5:27: Unresolved reference: Copy
e: /Users/dalexiv/Workspace/script-zipper/build.gradle.kts:6:9: Unresolved reference: from
e: /Users/dalexiv/Workspace/script-zipper/build.gradle.kts:7:9: Unresolved reference: into
也许我错过了某种要包含的插件?我怎么做?