如何将我的Gradle项目外部依赖项下载到特定文件夹? [英] How do I download my Gradle project external dependencies to a specific folder?

查看:532
本文介绍了如何将我的Gradle项目外部依赖项下载到特定文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的依赖关系下载到我的构建过程中的一部分构建过程中的特定文件夹中。 build / lib。我无法找到说明如何做到这一点的文档,我敢肯定,有一种简单的方法可以做到这一点,我错过了。我目前的(缩短的)build.gradle如下。该项目编译并正确执行测试。

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


推荐答案

我不知道你是否试过这个,但看看它是否可行

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

它对我有用。

请到以下地址:-): http:// forums。 gradle.org/gradle/topics/how_can_i_gather_all_my_projects _dependencies_into_a_folder

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

这篇关于如何将我的Gradle项目外部依赖项下载到特定文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆