The solution proposed by @slott worked for me but it didn’t add transitive dependencies (dependencies of the included dependencies).
The solution, found in this thread, was to use the runtimeClasspath
instead of the compileClasspath
. So the solution for my case was:
jar {
from {
configurations.runtimeClasspath.filter{ it.exists() }.collect { it.isDirectory() ? it : zipTree(it) }
}
}