Maven设置本地仓和阿里云远程仓

在maven项目导入jar包坐标时需要连接maven官方仓库下载,但是下载速度感人,所以来修改一下设置。

设置成为本地仓和连接阿里云的远程仓库。

(本地仓如果没有这个jar)

  1. 找出相应配置文件:例如我的目录:C:\soft\apache-maven-3.6.2\conf\settings.xml找到setting.xml。
  2. 用notepad++打开setting.xml文件。找到<localRepository>这个标签
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
   <localRepository>/path/to/local/repo</localRepository>
   -->
插入下面这行代码,一般情况下是在50行

左右
主要作用是设置自己的本地仓库路径。例如我的本地仓路径是在C:\soft\repo
<localRepository>C:\soft\repo</localRepository>

  3.找到<mirrors>   </mirrors>这两个标签

  4.在标签中添加:

      <mirror>
                <id>alimaven</id>
                <name>aliyun maven</name>
              <url>http://maven.aliyun.com/nexus/content/groups/public</url>
              <mirrorOf>central</mirrorOf>
          </mirror>
这个主要是设置阿里云的远程仓库。

下面是我的配置文件的截图:

猜你喜欢

转载自www.cnblogs.com/pansin/p/12043852.html