How to Run Standalone Kotlin with Gradle
Blog post from StackHawk
In an effort to integrate specific alerting capabilities into their build process using a third-party product, a team needed to execute their Kotlin code as a standalone application. The third-party system only supported execution through a single jar file, which necessitated the creation of a "fat" jar that included all third-party dependencies. Using Gradle as their build tool, the team employed the application plugin to define the main class in Kotlin, set up the `build.gradle.kts` file to accommodate the main class, and configured the jar task to include all necessary dependencies by modifying the manifest's `Main-Class` attribute. This setup allowed them to build the jar file and run it as expected in the third-party system, facilitating not only this integration but also supporting other use cases such as one-off and scheduled jobs.