https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
e

Evan R.

08/19/2019, 12:59 AM
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

Dominaezzz

08/19/2019, 1:55 AM
I'm guessing you are using
withJava()
for the JVM target?
b

Big Chungus

08/19/2019, 7:48 AM
Just define application.mainClass and you;ll be good to go
☝️ 2
m

mbonnin

08/19/2019, 8:22 AM
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

Big Chungus

08/19/2019, 8:26 AM
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

Evan R.

08/19/2019, 3:14 PM
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

Big Chungus

08/19/2019, 3:31 PM
The example above configures jar as fat jar
e

Evan R.

08/19/2019, 3:39 PM
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
5 Views