fkrauthan
03/10/2020, 7:17 PMSebastien Leclerc Lavallee
03/10/2020, 7:23 PMplugins {
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
}
apply plugin: 'kotlinx-serialization'
apply plugin: 'application'
Sebastien Leclerc Lavallee
03/10/2020, 7:35 PMapplication
plugin, generate the application but when executing, can’t find main classBig Chungus
03/10/2020, 7:50 PMfkrauthan
03/10/2020, 8:40 PMBig Chungus
03/10/2020, 9:13 PMfkrauthan
03/10/2020, 9:16 PMBig Chungus
03/11/2020, 8:42 PMafterEvaluate {
tasks {
val compileKotlinJvm by getting(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class)
val jvmProcessResources by getting(Copy::class)
val jvmRun by creating(JavaExec::class) {
dependsOn(compileKotlinJvm, jvmProcessResources)
group = "run"
main = "lt.petuska.IndexKt"
classpath = configurations["jvmRuntimeClasspath"] + compileKotlinJvm.outputs.files +
jvmProcessResources.outputs.files
workingDir = buildDir
}
val jvmJar by getting(Jar::class) {
manifest {
attributes["Main-Class"] = jvmRun.main
attributes["Version"] = project.version
}
}
}
}
fkrauthan
03/11/2020, 9:11 PMSebastien Leclerc Lavallee
03/11/2020, 9:54 PMfkrauthan
03/11/2020, 10:02 PMargs = System.getProperty("exec.args", "").split(" ")
To the jvmRun command. This way I can use -Dexec.args=""
to pass along command line arguments (not perfect but will do for some testing in my case)fkrauthan
03/11/2020, 10:03 PMfrom(kotlin.jvm().compilations.getByName("main").compileDependencyFiles.map { if (it.isDirectory) it else zipTree(it) })
to the jvmJar
command to pack dependencies into my fat jarSebastien Leclerc Lavallee
03/11/2020, 10:04 PMSebastien Leclerc Lavallee
03/12/2020, 12:59 AMSebastien Leclerc Lavallee
03/12/2020, 2:21 PM.kts
file, I did run task jvmJar
and the jar is produced. Now how can I use that jar file with the script? Thanks 🙂Big Chungus
03/12/2020, 2:25 PM./gradlew jvmRun
Big Chungus
03/12/2020, 2:26 PMSebastien Leclerc Lavallee
03/12/2020, 2:56 PMprotoc
plugin… I did manage to manualy change the .sh
file generated from the gradle application plugin. Fingers crossed 🤞 kotlin multiplatform and application plugins will be working in the futureBig Chungus
03/12/2020, 2:59 PMBig Chungus
03/12/2020, 2:59 PMSebastien Leclerc Lavallee
03/12/2020, 3:43 PM