In Eclipse, you can create a project jar with its required dependencies in an adjacent sub-folder by doing ...
Export->Java->Runnable JAR file
Select Library handling option: Copy required libraries into a sub-folder next to the generated JAR
Is there a way to do this with the Gradle?
PS: I am working on gradle 2.2.1
You can create a Gradle task for copying, like so:
Edit:
Run via
gradlew copyLibs
. You can make the task depend on the build task that builds your project.Note that you may have to also create the
path/to/subfolder/next/to/generated/jar/
in the task.