1、LocalRepository 本地仓库配置
<localRepository>D:/Users/local/repo</localRepository>
2、repositories里指定要用到的远程仓库,包括远程仓库的唯一标识、地址、名称、怎么用(比如是否可以拉SnapShot的依赖),这里可以多指定一些仓库,maven找依赖的时候,如果本地仓库没有,就在这些远程仓库里从上往下找,找到就下载,全找完还找不到就是找不到了
<repositories>
<!-- 配置依赖仓库,可以配置多个仓库,maven会按照顺序进行依赖的加载 -->
<repository>
<id>central</id>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>rdc-releases</id>
<url>https://repo.rdc.aliyun.com/repository/73702-release-Kgsln6/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>rdc-snapshots</id>
<url>https://repo.rdc.aliyun.com/repository/73702-snapshot-ZfDKB4/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
3、mirrors里指定的是仓库的代理,通过在mirrorOf里指定要代理的仓库(可以直接指定,也可以用一些匹配符来指定),来代理向远程仓库发起的请求,如果repositories里的仓库id被mirrorOf匹配到了,那么maven向这个仓库发的请求,就被mirrors规则代理到其他URL了
<mirrors>
<mirror>
<id>mirror</id>
<mirrorOf>!rdc-releases,!rdc-snapshots</mirrorOf>
<name>mirror</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
4、servers里定的是身份认证信息,因为一般私服都要用户名和密码,不然不安全,所以看一在这里指定用户名和密码,repository里的id匹配到servers里的id从而找到用户名和密码来访问repository
<servers>
<server>
<id>rdc-releases</id>
<username>xxx</username>
<password>xxxxxxxx</password>
</server>
<server>
<id>rdc-snapshots</id>
<username>xxx</username>
<password>xxxxxxxx</password>
</server>
</servers>
5、激活profile配置 activeProfiles,用来激活配置的profile。
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
注意:局部配置优先于全局配置。 配置优先级从高到低:pom.xml> user settings > global settings