Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I download my Gradle project external dependencies to a specific folder?

I want to download my dependencies to a specific folder in my build as part of my build process e.g. build/lib . I can't find documentation which shows how to do this, I'm sure there is a straightforward way to do it that I'm missing. My current(shortened) build.gradle is the following. The project compiles and executes test correctly.

apply plugin: 'java'
apply plugin: 'maven-publish'

repositories {
    mavenCentral()        
}         

dependencies {
   compile(
           'aopalliance:aopalliance:1.0',
           'log4j:log4j:1.2.17',
           'batik:batik-svg-dom:1.6-1')
   }
}
like image 221
Damien Avatar asked Oct 15 '13 15:10

Damien


1 Answers

I dont know if you tried this, but see if this works

task copyToLib(type: Copy) {
    into "$buildDir/output/lib"
    from configurations.runtime
}
build.dependsOn copyToLib

It worked for me.

Credit where its due :-) : http://forums.gradle.org/gradle/topics/how_can_i_gather_all_my_projects_dependencies_into_a_folder

like image 125
Ravi Vasamsetty Avatar answered Jan 02 '23 12:01

Ravi Vasamsetty