Download a Gradle project's Maven dependencies into a directory. For example, you might find this technique useful for very small and simple projects where you want to commit the .jar
files directly into Git. This technique was taken from this StackOverflow answer.
Define a downloadDependencies
Gradle task, that when executed, will put all of the project's dependencies into a directory named lib/
.
task downloadDependencies(type: Copy) {
from sourceSets.main.runtimeClasspath
into 'lib/'
}
Alternatively, here is the same snippet but written using Gradle's Kotlin DSL (WARNING: I'm not sure if this correct):
tasks.register<Copy>("downloadDependencies") {
val sourceSet = sourceSets.main.get().runtimeClasspath
from(sourceSet)
into("lib/")
}