先看官方怎么说:
也就是说${user.home}/.m2/settings.xml这个是单个用户的路径,而${maven.conf}/settings.xml时候全局的路径
目前看到 idea 自带的 maven 在用户路径下没有 settings.xml(不知道原因,可能需要自己配置?),但是全局下是有这个 settings.xml,全剧路径如下:
mac 的 settings.xml 我的位置是:
/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/conf/settings.xml
然后 local repository 我的位置是:
/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/conf/repository
但是我的 idea 指向的 settings.xml 位置我依然按照默认位置去指定${user.home}/.m2/settings.xml,包括 repository 也是按照默认位置去指定,虽然用户范围位置没有这个 settings 文件但是发现依然生效,因为我改了全局的这个 settings,怀疑是用户路径找不到 settings 就会被全局的 settings 所取代
其他注意:
注意你要是编辑这块位置需要给 iterm2 或者终端开放磁盘完全访问权限,否则创建文件会失败
「安全性设置」-「完全磁盘访问权限」
如果是编辑 settings.xml 文件,那么需要 chmod 一下
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd">
<localRepository>C:\java\m2\repositorylocalRepository>
<pluginGroups>
pluginGroups>
<proxies>
proxies>
<servers>
servers>
<mirrors>
<mirror>
<id>alimavenid>
<name>aliyun mavenname>
<url>
http://maven.aliyun.com/nexus/content/groups/public/
url>
<mirrorOf>centralmirrorOf>
mirror>
mirrors>
<profiles>
profiles>
settings>