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

痞子三分冷 提交于 2019-12-07 04:45:07

问题


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')
   }
}

回答1:


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



来源:https://stackoverflow.com/questions/19385451/how-do-i-download-my-gradle-project-external-dependencies-to-a-specific-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!