默认~/.m2/settings.xml不存在,需要拷贝%M2_HOME%/conf/settings.xml
全局范围%M2_HOME%/conf/settings.xml,一般不要改
用户范围~/.m2/settings.xml
1. 定义本地仓库的位置
默认本地仓库位置~/.m2/reponsitory
<settings>
<localRepository>d:/maven-jars/reponsitory</localRepository>
</settings>
将本地构件(jar)安装到本地仓库
mvn clean install
2. 远程仓库认证
<settings>
<servers>
<server>
<id>central</id>仓库的标识
<username>proj-username</username>
<password>proj-password</password>
</server>
</servers>
</settings>
3. 配置中央仓库镜像、私服镜像
<settings>
<mirrors>
<mirror>
<id>my.maven.com</id>仓库的标识
<name>my maven mirror</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>my.maven.com</id>仓库的标识
<name>my maven mirror</name>
<url>http://IP/path</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
<mirrorOf>*</mirrorOf> 匹配所有远程仓库
<mirrorOf>external:*</mirrorOf> 匹配所有不在本级的远程仓库
<mirrorOf>rep1,rep2</mirrorOf> 匹配rep1和rep2两个远程仓库,多个远程仓库之间用逗号隔开
<mirrorOf>*,!rep1</mirrorOf> 匹配所有远程仓库,除了rep1