Make Gradle使用Maven本地存储库来下载工件 [英] Make Gradle use Maven local repository for downloading artifacts

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

问题描述

我知道我可以配置Gradle使用本地Maven存储库

I know I can configure Gradle to use local Maven repository

repositories {
    mavenLocal()
    mavenCentral()
}

我可以配置Gradle下载到本地(maven)存储库? (这样Maven也可以使用那些罐子)

Can I configure Gradle to download into Local (maven) repository? (So that Maven would also be able to use those jars)

ref 使用maven本地存储库的Gradle配置

推荐答案

解决方案是在gradle论坛中给出:
https://discuss.gradle.org/t/need-a-gradle-task-to-copy-all-dependencies-to-a-local-maven- repo / 13397/2

A solution was given in the gradle forums: https://discuss.gradle.org/t/need-a-gradle-task-to-copy-all-dependencies-to-a-local-maven-repo/13397/2

使用此gradle插件: https://github.com/ysb33r/ivypot-gradle-plugin
你可以称之为新的节目

using this gradle plugin: https://github.com/ysb33r/ivypot-gradle-plugin you can call a new tasg

gradle syncRemoteRepositories

将所有依赖项下载到本地常春藤存储库(与Maven使用的库相同)。您指向的文件夹

which will download all dependencies to a local Ivy repository (which is the same library Maven uses). The folder you point to with

syncRemoteRepositories {
   repoRoot '/path/to/repo'
}

将包含依赖项。我建议先尝试使用与M2_HOME不同的本地路径,因为我看到一些关于Iven存储库结构在Maven版本之间发生变化的警告。

will contain the dependencies. I would suggest first trying out with a different local path than your M2_HOME, because I saw some warning about the Ivy repository structure having changed between Maven versions.

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

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