Gradle task to put jars from Maven repository into project lib folder

6.2k views Asked by At

http://blog.jonasbandi.net/2014/03/running-nodejs-applications-on-jvm-with.html describes how to prepare to run Avatar.js project.

For a Avatar.js project some jar and native binaries are at maven repository https://maven.java.net/content/repositories/public/com/oracle/

I'd like to use gradle task to get jars from Maven repository and put into lib folder. The research show it is possible.

http://forums.gradle.org/gradle/topics/create_a_local_mirror_for_dependencies

http://gradle.1045684.n5.nabble.com/collecting-only-external-dependency-files-td5117615.html#a5680602

Is there some more standard implementation of such task as of April 2014 ?

UPDATE:

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

repositories {
    maven {
        url "https://maven.java.net/content/repositories/public/"
    }
}

dependencies {
    compile "com.oracle.avatar-js:avatar-js:0.10.+"
}

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

There are 1 answers

4
Opal On BEST ANSWER

Sample script:

apply plugin: 'java'

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    compile 'com.google.guava:guava:16.0.1'
}

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