欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mac下maven配置阿里云镜像

程序员文章站 2022-06-05 17:30:47
...

一、找到setting.xml
我的是brew,所以用

brew info maven

找到安装目录下面的setting.xml

maven: stable 3.6.2
Java-based project management
https://maven.apache.org/
Conflicts with:
  mvnvm (because also installs a 'mvn' executable)
/usr/local/Cellar/maven/3.6.1 (79 files, 10.2MB) *
  Built from source on 2019-09-01 at 17:15:55
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/maven.rb
==> Requirements
Required: java >= 1.7 ✔
==> Analytics
install: 56,907 (30 days), 131,279 (90 days), 529,034 (365 days)
install_on_request: 53,113 (30 days), 125,011 (90 days), 494,959 (365 days)
build_error: 0 (30 days)

二、更改设置

更改为下面:

  <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>