Gradle 使用maven非默认的本地仓库

    任何三方的官方文档很重要,如果公司没有梯子,用bing的国际版也可以的,不过要用英文搜。

    官方原文

    背景:克隆了个git上的项目,这个项目是使用Gradle构建,但自己一直在用Maven。装好Gradle后Build,但又发现Gradle使用自己的本地仓库,理所当然就要用Maven本地仓库。

    Gradle会读取 USER_HOME/.m2/settings.xml 与 M2_HOME/conf/settings.xml,并以 USER_HOME/.m2/settings.xml为主。如果上面提到的两个位置都没有settings.xml,则会采用默认的 USER_HOME/.m2/repository 位置。

    P.S:用 echo $USER_HOME 查看相应位置。

原文:

Gradle uses the same logic as Maven to identify the location of your local Maven cache. If a local repository location is defined in a settings.xml, this location will be used. The settings.xml in USER_HOME/.m2 takes precedence over the settings.xml in M2_HOME/conf. If no settings.xml is available, Gradle uses the default location USER_HOME/.m2/repository.

你可能感兴趣的:(Gradle)