Last active
February 27, 2019 22:32
-
-
Save bibarsov/3b17aa8af7a98c922ccff4e1a1418c27 to your computer and use it in GitHub Desktop.
Export Jar with dependencies (Gradle)
This file contains hidden or 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
task fatJar(type: Jar) { | |
manifest { | |
attributes 'Implementation-Title': 'Gradle Jar File Example', | |
'Implementation-Version': version, | |
'Main-Class': 'com.example.Main' | |
} | |
baseName = project.name + '-all' | |
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } | |
with jar | |
} | |
#Later versions | |
task fatJar(type: Jar) { | |
manifest { | |
attributes( | |
'Implementation-Title': '...', | |
'Implementation-Version': version, | |
'Main-Class': 'Main' | |
) | |
} | |
baseName = project.name | |
from { | |
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