把 maven 默认仓库 .m2 指定到本地目录

Posted Yan Yang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了把 maven 默认仓库 .m2 指定到本地目录相关的知识,希望对你有一定的参考价值。

  • 找到 maven 默认仓库,新建一个 settings.xml 文件;
  • settings.xml 文件为
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <!-- 本地仓库地址 -->
    <localRepository>D:\\Maven\\repository</localRepository>
    <mirrors>
        <!-- 阿里仓库镜像 -->
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>
</settings>

以上是关于把 maven 默认仓库 .m2 指定到本地目录的主要内容,如果未能解决你的问题,请参考以下文章