我有一个Kotlin Gradle项目,我想在jar文件中包含Kotlin的运行时和stdlib。我目前正在使用它,但是当我使用build.gradle配置构建项目时,它不包括运行时或stdlib。Gradle compileKotlin includeRuntime不向jar添加运行库
compileKotlin {
kotlinOptions {
includeRuntime = true
noStdlib = false
}
}
这是我使用包括罐中的运行/ STDLIB的摇篮代码,但它不工作像我期望它。下面是一些背景完整的build.gradle文件: https://github.com/BenWoodworth/CrossPlatformGreeter/blob/bd1da79f36e70e3d88ed871bc35502ecc3a852fb/build.gradle#L35-L43
科特林的摇篮文件似乎表明kotlinOptions.includeRuntime设置为true,应包括在产生的.jar的科特林运行。
https://kotlinlang.org/docs/reference/using-gradle.html#attributes-specific-for-kotlin
编辑: 这可能是相关的。当我运行compileKotlin,我得到了几个相关的运行时警告:
:compileKotlin
w: Classpath entry points to a non-existent location: <no_path>\lib\kotlin-runtime.jar
BUILD SUCCESSFUL