Skip to content

Instantly share code, notes, and snippets.

@torgeir
Created June 15, 2021 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torgeir/fd257ce8c4462cf496877c60fc3195ed to your computer and use it in GitHub Desktop.
Save torgeir/fd257ce8c4462cf496877c60fc3195ed to your computer and use it in GitHub Desktop.
Gradle no plugin solution for building fat jars
val fatJar = task<Jar>("fatJar") {
with(tasks["jar"] as CopySpec)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(configurations.runtimeClasspath.get().map {
if (it.isDirectory) it
else zipTree(it)
})
manifest {
attributes["Main-Class"] = "io.ktor.server.netty.EngineMain"
}
}
tasks.getByName("build")
.dependsOn(fatJar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment