A runnable jar with Kotlin and Gradle

Forketyfork
4 min readNov 15, 2022

In this article, I’ll describe how to build a runnable jar from a Kotlin application using Gradle, and try to clarify some points of confusion and errors you may face in the process. I’ll describe both Groovy and Kotlin ways of configuring the build scripts.

Initial setup

It’s pretty easy to generate a sample Kotlin project with a runnable application. Just fire up your console, create a directory (let’s name it hello), go inside, and run gradle init:

mkdir hello
cd hello
gradle init

--

--

Forketyfork

Software developer @ JetBrains Space. I write technical how-to articles and occasional rants on software development in general. Opinions are my own.