Created
September 19, 2014 06:45
-
-
Save lucacesari/27f321c0356f63017ea8 to your computer and use it in GitHub Desktop.
Create a fat jar with Gradle
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
ext { | |
vendor = "vendor" | |
version = "42.0" | |
basename = "foo" | |
mainClassName = "bar.foo.mainClass" | |
} | |
dependencies { | |
compile project(':my_other_project') | |
compile 'ch.qos.logback:logback-classic:1.1.1' | |
compile fileTree(dir: "../libs", includes: ['*.jar']) | |
} | |
jar { | |
baseName = basename | |
manifest { | |
attributes "Manifest-Version" : "1.0" | |
attributes "Created-By" : vendor | |
attributes "Specification-Title" : basename | |
attributes "Specification-Version" : version | |
attributes "Specification-Vendor" : vendor | |
attributes "Implementation-Title" : basename | |
attributes "Implementation-Version" : version | |
attributes "Implementation-Vendor" : vendor | |
attributes 'Main-Class': mainClassName | |
attributes 'Class-Path': '.' | |
} | |
from (configurations.compile.files.collect { it.isDirectory() ? it : zipTree(it) } ) { | |
exclude "META-INF/*.SF" | |
exclude "META-INF/*.DSA" | |
exclude "META-INF/*.RSA" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment