maven设置本地仓库和远程仓库

1.打开setting.xml文件

2.搜索localrepository,找到设置本地仓库的位置

3.将标签中的地址修改为你想要指定的仓库位置

4.搜索mirrors,定位到指定设置镜像仓库的位置

5.设置远程仓库,示例如下:

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
	 <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>       
	 </mirror>
  </mirrors>

6.保存文件即可

posted @ 2020-04-10 21:34  指尖探戈  阅读(766)  评论(0编辑  收藏  举报