If I’m using a gradle script with the kotlin DSL, ...
# multiplatform
e
If I’m using a gradle script with the kotlin DSL, how can I build an executable JAR file? I can’t seem to get the application plugin to build the way I want it to
d
I'm guessing you are using
withJava()
for the JVM target?
b
Just define application.mainClass and you;ll be good to go
☝️ 2
m
It also depensd what you mean by "executable" JAR. The application plugin will create start scripts for you to setup the correct classpath
Alternatively, you may want to create a fatjar so that it can be run with
java -jar ***
1
b
Or you can ignore application plugin (as one of its tasks clashes with multiplatform plugin's) and cofigure jar task yourself: https://gitlab.com/kotlin-examples/transaction-api/blob/master/build.gradle.kts
e
I managed to set the main class with the application plugin but I’m going more for a fat JAR with the JVM dependencies inside, sort of like with the shadow plugin
b
The example above configures jar as fat jar
e
Right, but it doesn’t appear to be using the multiplatform plugin. I found something close to what I want to do in the reply to this post in the kotlin forums: https://discuss.kotlinlang.org/t/kotlin-1-3-m2-new-multiplatform-projects-model/9264/103
Issue is, in my shadow configuration setting
configurations
equal to that
runtimeDependencyFiles
property doesn’t seem to work because they’re two different types