Skip to content

Instantly share code, notes, and snippets.

@azmankudus
Created October 19, 2020 15:54
Show Gist options
  • Save azmankudus/2469b65627c238c0aae6f0116f9a9026 to your computer and use it in GitHub Desktop.
Save azmankudus/2469b65627c238c0aae6f0116f9a9026 to your computer and use it in GitHub Desktop.
Gradle Fat JAR build
plugins {
id 'application'
id 'java'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
...
}
application {
mainClassName = 'test.App'
}
task fatJar(type: Jar) {
manifest {
attributes 'Main-Class': 'test.App'
}
archiveClassifier = "all"
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment