Created
July 24, 2019 06:46
-
-
Save prameshbhattarai/b3e98d558121fa2c3043e483b1220fe9 to your computer and use it in GitHub Desktop.
creating jar file with dependencies in 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
// creating jar file with all dependencies | |
jar { | |
manifest { | |
attributes "Main-Class": "PATH_TO_MAIN_CLASS" | |
} | |
from { | |
// filters only existing and non-empty dirs | |
sourceSets.main.runtimeClasspath | |
.filter { (it.isDirectory() && it.listFiles().length > 0) || it.isFile() } | |
.collect { it.isDirectory() ? it : zipTree(it) } | |
} | |
} | |
// then simply run | |
// gradle clean jar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment