macOS Maven路径 一般在
/usr/local/maven/apache-maven-3.6.3
进入conf
目录,修改settings.xml
,
sudo vim /usr/local/maven/apache-maven-3.6.3/conf/settings.xml
找到mirror
元素,添加阿里云仓库镜像代码,如下
<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>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>Aliyun Maven Public</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
接下来在IDE中配置Maven的安装路径和自定义的配置文件路径即可。