我将问题归结为以下最小设置 - 只是一个问候世界。这个有效:
https://github.com/ligi/MinimalKotlinCommandLine
当我切换到kotlin:1.0.0-beta-4584并运行(gradle clean run)时出现以下错误:
Error: Could not find or load main class minimalkotlincommandline.MinimalkotlincommandlinePackage
使用此build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.0-beta-4584'
}
}
apply plugin: "kotlin"
apply plugin: 'application'
mainClassName = "minimalkotlincommandline.MinimalkotlincommandlinePackage"
repositories {
mavenCentral()
}
dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-4584'
}
和这个Main.kt: package minimalkotlincommandline
fun main(args: Array<String>) {
println("Hello world ")
}
答案 0 :(得分:5)
将mainClassName更改为
mainClassName = "minimalkotlincommandline.MainKt"
从Kotlin版本M14 top-level naming changed起${Package}Package
到${File}Kt
。有关documentation的更多信息。