Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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'
}
like image 969
Paul Verest Avatar asked Apr 16 '14 12:04

Paul Verest


People also ask

Where are Gradle dependency jars?

Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file). This declares a dependency on version 12.3 of the "app-magic" library, inside the "com.example.android" namespace group.


1 Answers

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'
}
like image 136
Opal Avatar answered Oct 12 '22 15:10

Opal