Created
January 7, 2020 04:32
-
-
Save nickytoh/d04e380832f2d7ad31464b1841929f03 to your computer and use it in GitHub Desktop.
Generate a fat jar by Gradle Kotlin DSL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run gradle jar in the command line to get the jar | |
plugins { | |
java | |
application | |
kotlin("jvm") version "1.3.60" | |
} | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
implementation(kotlin("stdlib", "1.3.60")) // | |
} | |
application { | |
mainClassName = "package.name.MainClassName" // Don't append Kt to class name. | |
} | |
val jar by tasks.getting(Jar::class) { | |
manifest { | |
attributes["Main-Class"] = application.mainClassName | |
} | |
from(configurations.compileClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment