Gradle等同于Maven的“复制依赖”? [英] Gradle equivalent to Maven's "copy-dependencies"?
问题描述
mvn依赖:copy-dependencies
和 boom ,Maven会在当前目录内创建一个 target /
目录,并将所有可传递获取的JAR放置到该位置。
我现在正在尝试切换到Gradle,但Gradle似乎没有相同的功能。所以我问: Gradle是否等价于Maven的 copy-dependencies
?如果是这样,有人可以提供一个例子吗?如果没有,其他开发人员是否认为这对Gradle社区是一个有价值的贡献?
apply插件:$ c> copy-dependencies
在gradle中,但这是一个任务: 'java'
$ b $ repositories {
mavenCentral()
}
依赖项{
compile'com.google.inject:guice:4.0 -beta5'
}
任务copyDependencies(类型:复制){
from configurations.compile
到'dependencies'
}
是否值得做贡献?你可以看到这很容易做到,所以我不这么认为。
In Maven-land, anytime I want to simply pull down the transitive dependencies for a particular POM file, I just open a shell, navigate to where the POM is located, and run:
mvn dependency:copy-dependencies
And boom, Maven creates a target/
directory inside the current one and places all the transitively-fetched JARs to that location.
I am now trying to make the switch over to Gradle, but Gradle doesn't seem to have the same feature. So I ask: Does Gradle have an equivalent to Maven's copy-dependencies
? If so, can someone provide an example? If not, would other devs find this to be a worthwhile contribution to the Gradle community?
There's no equivalent of copy-dependencies
in gradle but here's a task that does it:
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.inject:guice:4.0-beta5'
}
task copyDependencies(type: Copy) {
from configurations.compile
into 'dependencies'
}
Is it worthwhile to do a contribution? AS You can see it's really easy to do, so I don't think so.
这篇关于Gradle等同于Maven的“复制依赖”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!