Skip to content

Instantly share code, notes, and snippets.

@domnikl
Last active October 11, 2024 11:06
Show Gist options
  • Save domnikl/c19c7385927a7bef7217aa036a71d807 to your computer and use it in GitHub Desktop.
Save domnikl/c19c7385927a7bef7217aa036a71d807 to your computer and use it in GitHub Desktop.
Gradle Kotlin DSL: set main class attribute for jar
tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = "com.example.MainKt"
}
}
@pmatsinopoulos
Copy link

Thank you!

@NotThatRqd
Copy link

thx

@Kyu
Copy link

Kyu commented Aug 30, 2023

You can have a complete example on stackoverflow on how to set up your build.gradle.kts for it to work. Just that may not be enough to build your kotlin jar.

@sylhare mvp 👑, works great for the new gradle build.gradle.kts files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment