Skip to content

Instantly share code, notes, and snippets.

@tinytengu
Created August 11, 2021 14:55
Show Gist options
  • Save tinytengu/6b762cb1b1c769905d61406dd198f454 to your computer and use it in GitHub Desktop.
Save tinytengu/6b762cb1b1c769905d61406dd198f454 to your computer and use it in GitHub Desktop.
Gradle build full .jar file task
baseName = 'test'
mainClass = 'org.tinytengu.main.Main'
jar {
manifest {
attributes "Main-Class": "${mainClass}"
}
}
task allJar(type: Jar) {
archiveBaseName = '${baseName}'
manifest.from jar.manifest
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
with jar
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment