Hi, I'm searching for a way to package a Kotlin ex...
# build-tools
c
Hi, I'm searching for a way to package a Kotlin executable JAR built with Gradle to distribute it to user. I managed to do it with shadowJar, but that means pushing multiple megabytes to CI/CD, when all the dependencies are already in maven repositories... It sounds like there should be a way to have the user automatically download all of those directly? My ultimate aim is to have a small bash/shell script that I could distribute, that would download everything and run it with the correct classpath
m
I'd love to have an easy way to distribute executable jar files. The closest I have found is to distribute a
.main.kts
file that would download the depdendencies
It'll require users to have kotlin installed on their machine
c
How do you do this? I've tried with kscript, but currently the dependency download is completely broken
m
Name a file
something.main.kts
and Kotlin 1.3.72+ can execute it
The dependency download is also broken but in different ways than kscript 🙈 so it might suit you better
I wrote this some time ago which is not too obsolete yet: https://medium.com/@mbonnin/may-2020-the-state-of-kotlin-scripting-99cb6cc57db1
long story short,
kscript
dependency download doesn't work on Java > 8.
*.main.kts
dependency resolution of transitive dependencies is limited (https://youtrack.jetbrains.com/issue/KT-38006) but working with Java > 8