从https://kotlinlang.org/docs/tutorials/javascript/getting-started-gradle/getting-started-with-gradle.html我得到了以下 build.gradle (groovy) 脚本:
group 'org.example'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin2js'
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
}
我试过这个翻译:
group 'org.example'
version '1.0-SNAPSHOT'
buildscript {
extra["kotlinVersion"] = "1.3.61"
repositories {
jcenter()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${extra["kotlinVersion"]}")
}
}
plugins {
kotlin2js // <= this is incorrect
application
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-js:${extra["kotlinVersion"]}")
}
application {
mainClassName = "io.ipfs.kotlin.MainIpfsKt"
}
gradle 发出以下错误消息
kotlin2js
^ Unresolved reference: kotlin2js
apply plugin: 'kotlin2js'的正确翻译是什么?