maven仓库优先级:本地仓库(localRepositories) > pom.xml文件中的repositories仓库 > setting.xml配置文件中mirrors镜像仓库
maven会根据优先级规则逐级往下一层一层查找对应的仓库中有没有所需要的资源,如果有的话,则将资源返回,不再继续往下查找;如果没有的话,则去下一级或者下一层进行查找。
本地仓库(localRepositories):指的是setting.xml配置文件中localRepository标签对所指定的地方
pom.xml文件中的repositories仓库:指的是pom.xml中repositories标签对所包裹的配置,如下所示:
<repositories>
<repository>
<!--jar包私服仓库-->
<id>company-release</id>
<url>http://192.168.1.105:8082/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<!--插件私服仓库-->
<id>company-release</id>
<url>http://192.168.1.105:8082/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
mirrors镜像仓库:
<mirrors>
<!--阿里云仓库镜像配置-->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
上述这种配置组合是个人目前比较喜欢的一种