如何将依赖关系复制到Gradle中的生成目录 [英] How to Copy dependencies to Build directory in Gradle

查看:300
本文介绍了如何将依赖关系复制到Gradle中的生成目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将依赖关系复制到Gradle中构建目录,而无需在build.gradle中添加任何任务,如mvn dependency:copy-dependencies ..

>

如果你真的不想为此做任务,你可以使用项目的 copy 方法

 配置{
编译
}

依赖关系{
编译'someGroup:someArtifact:someVersion'
}

project.copy {
from project.configurations.compile
into project.buildDir
}

一个明显的效果就是每次调用都会触发解析,即使您只想要要列出任务,解析和复制将被触发。


How to Copy dependencies to Build directory in Gradle without adding any tasks in build.gradle like mvn dependency:copy-dependencies..

解决方案

If you really don't want a task for this you could use the copy method of the project object.

configurations {
    compile
}

dependencies {
    compile 'someGroup:someArtifact:someVersion'
}

project.copy {
    from project.configurations.compile
    into project.buildDir
}

One noticeable effect of this is that the resolving will be triggered for every invokation i.e. even if you only want to list tasks the resolve and copy will be triggered.

这篇关于如何将依赖关系复制到Gradle中的生成目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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