Sorry, still can’t configure build properly: what should be included where?
I added extra dependencies:
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
And tried different sources:
jar {
manifest.attributes["Main-Class"] = "MainKt"
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from("compileKotlin").outputs
// val dependencies = configurations.runtimeClasspath.get().map(::zipTree)
// from(dependencies)
// from(getByName("compileKotlin"))
// from(
// configurations.runtimeClasspath.get().map {
// it.takeIf { it.isDirectory } ?: zipTree(it)
// }
// )
And even added a .jar lib into build/libs/kotlin-stdlib-jdk8-1.8.21.jar (but it is deleted after gradle clean
, so it doesn’t belong there, so I put it into lib
also).
And still I have the error:
java -jar kapp-1.0-SNAPSHOT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at MainKt.main(main.kt)
How should I configure my build.gradle.kts
properly? I use kotlinOptions.jvmTarget = "17"