shashwatZing shashwatZing - 4 months ago 23
Groovy Question

write a gradle script that saves all the dependency into the ${projectDir}/lib folder

So I have a gradle script which gets all its dependencies from the following repository

repositories {
maven { url '' }

ivy { url ' cache'
layout 'pattern', {
artifact '[organization]/[module]/[revision]/[type]/[module]-[revision].jar'


so when I run a customized gradle task which i wrote as

task showMeCache << {
configurations.compile.each { println it }

It will show that my jars are being saved locally on


I want to write a gradle task that will put all the dependencies for a given project into something like a ${projectDir}/lib folder instead of the default location provided by gradle. Any help would be appreciated. Thanks


You can write a Copy task for that purpose:

task copyLibs(type: Copy) {
    from configurations.compile
    into 'lib'

Keep in mind that would still download and use the resolved dependencies from the Gradle cache.