Gradle将依赖关系下载到缓存中,而不是Maven存储库 [英] Gradle downloading dependency into cache instead of maven repository
问题描述
我试图在我的文件系统上为Maven和Gradle维护同一个存储库。但我遇到了一些问题。
我在 build.gradle
文件中有以下内容。
存储库{
mavenLocal()
mavenCentral()
}
依赖关系{
编译组:'org.codehaus.groovy',名称:'groovy-all',版本:'2.3.9'
运行组:'org.codehaus.groovy',名称:' groovy-all',版本:'2.3.9'
runtime'org.xerial:sqlite-jdbc:3.8.7'
}
GRADLE_HOME是 D:\Programming\Java\gradle-2.2.1
GRADLE_USER_HOME是 D:\Programming\Java\.m2
我的gradle home与我的Maven仓库。
但是当依赖通过gradle下载时,它们被下载到 GRADLE_USER_HOME \ cache
而不是储存库文件夹。我缺少什么配置?
编辑
我已经检查了关于
似乎gradle中没有这样的选项。有人可以确认吗?
没有设置可以改变它。没有像这样的gradle存储库。此外,由于存在混乱,使用gradle作为依赖缓存的gradle使用gradle似乎是个不错的主意。
如果您尝试发布由gradle构建的工件以表示Maven仓库,你应该看看 maven-publish 插件。
如果您尝试在构建中使用该存储库中的构件,那么可以添加 mavenLocal() code>到你的仓库,然后在你的依赖中使用
compile
函数。
I am trying to maintain the same repository on my filesystem for maven and gradle. But I am running into some problems.
I have the following in my build.gradle
file.
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.3.9'
runtime group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.3.9'
runtime 'org.xerial:sqlite-jdbc:3.8.7'
}
GRADLE_HOME is D:\Programming\Java\gradle-2.2.1
GRADLE_USER_HOME is D:\Programming\Java\.m2
My gradle home is the same as my Maven repository.
But when the dependencies are downloaded via gradle they are being downloaded into the GRADLE_USER_HOME\cache
instead of the repository folder. What configuration am I missing?
EDIT
I have checked the chapter on dependency management of the book Gradle In Action
. Nothing. I have checked the dependency management on gradle's website but it also just says that cache is used.
It seems that there is no such option available in gradle. Can someone confirm?
There is no setting to change that. There is no gradle repository as such. Also, it seems like a bad idea to have gradle use the repository's folder as dependency cache because of the clutter.
If you are trying to publish artifacts built by gradle to said maven repository, you should probably take a look at the maven-publish plugin.
If you are trying to use artifacts from that repository in your build, the way to go would be to add mavenLocal()
to your repositories and then just use the compile
function in your dependencies.
这篇关于Gradle将依赖关系下载到缓存中,而不是Maven存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!