Created
August 11, 2021 14:55
-
-
Save tinytengu/6b762cb1b1c769905d61406dd198f454 to your computer and use it in GitHub Desktop.
Gradle build full .jar file task
This file contains 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
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