Building a fat JAR

AWS has yet is not provided support to write a code in Kotlin. But being a JVM language, we can convert Kotlin into a JAR file. And we will upload the JAR file to AWS. And once the code is compiled, JVM should not worry about which language it was originally. JVM will only care about byte code, which Kotlin has already generated and bundled into the JAR file.

We have already configured a super-easy way to create a JAR file. In our gradle file, we have added a plugin:

apply plugin: 'com.github.johnrengelman.shadow'

It's a plugin that uses classes and resources used by it, wraps them in a single dependency, and converts them into a .jar file. It's often called fat JAR or uber JAR. The documentation says it uses the JarInputStream ...

Get Hands-On Serverless Applications with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.