Compile a single executable with all dependencies


I was asked to evaluate Kotlin as an alternative to learning Java. Running my script currently requires these two long commands:

kotlin hello.kt -include-runtime -cp xchange-core-4.2.0.jar;xchange-bitstamp-4.2.0.jar -d hello.jar
java -cp xchange-core-4.2.0.jar;xchange-bitstamp-4.2.0.jar;slf4j-api-1.7.21.jar;slf4j-simple-1.7.21.jar;rescu-1.9.0.jar;commons-io-2.5.jar;jackson-databind-2.8.4.jar;jackson-core-2.8.4.jar;jackson-annotations-2.8.0.jar;jsr311-api-1.1.1.jar;signpost-core-;hello.jar HelloKt

Is it possible to make Kotlin produce single file that I can put and run on remote server?


You can use gradle or maven to build a fat jar.


have a look at the Gradle application plugin, that probably does what you are looking for.


@fvasco can you recommend a good tutorial/link that gets straight to the point of making a fat jar with Maven? Like the one that sysadmin can understand and apply quickly to rebuild the project.


You may look for Apache Maven Shade Plugin.


You can build JAR file using Maven. Take a look at the post