Gradle配置使用maven本地存储库 [英] Gradle configuration to use maven local repository

查看:885
本文介绍了Gradle配置使用maven本地存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



默认情况下,maven将依赖JAR存储在USER_HOME / .m2 / repository中,而Gradle存储在USER_HOME文件夹中/.gradle/caches/modules-2。



对于同一个项目,我最终会在系统中添加2个jar副本。



是否有任何配置要在全局级别设置在gradle中,以便它使用现有的maven存储库而不是它自己的。




解决方案

您可以使用

  mavenLocal()

如果存储库的位置必须位于其他位置,您可以使用

 存储库{
maven {
url'/ path / to / your / repository'
}
}


I have Maven and Gradle both installed in my system.

By default maven stores the dependency jars in the USER_HOME/.m2/repository and Gradle stores in folder USER_HOME/.gradle/caches/modules-2 respectively.

For the same project, I am end up with 2 copies of jars in my system ultimately.

Is there any configuration to set up in the gradle at global level so that it uses existing maven repository instead of its own.

Thanks in advance.

解决方案

You can use

mavenLocal()

If location of repository must be in other place you can use

repositories {
    maven {
        url '/path/to/your/repository'
    }
}

这篇关于Gradle配置使用maven本地存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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