maven配置多个仓库
更改setting.xml
1、在<mirrors></mirrors>
标签里加入阿里仓库作为中央仓库
//阿里云maven仓库,访问下载速度快
<mirror>
<id>aliyun</id>
//<mirrorOf>*</mirrorOf>作为总库
//<mirrorOf>central</mirrorOf>作为中央库库
<mirrorOf>central</mirrorOf>
<name>aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
2、在<profiles></profiles>
标签里加入需要的私人仓库
<!--profile和repository里的id唯一,不可重复-->
<profile>
<id>XXX</id>
<repositories>
<repository>
<id>XXX maven</id>
<!--自己的仓库地址-->
<url>http://IP:PORT/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
如有多个配置如图
4、在最后的</setting>
标签里填入
<activeProfiles>
<activeProfile>aliyun</activeProfile>
<activeProfile>XXX</activeProfile>
</activeProfiles>
于2020-04-07日更新,确定可用测试图如下