1>方法一
之前在配置 Maven 的 settings.xml 时,都会设置 mirror 节点,例如:
alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central
然后第一想法就是在 mirrors 节点下多增加几个 mirror,然而并不可以。正确的操作是在 profiles 节点下配置多个 profile,而且配置之后要激活。例如:
配置profiles
boundlessgeo boundlessgeo https://repo.boundlessgeo.com/main/ true true always aliyun aliyun http://maven.aliyun.com/nexus/content/groups/public/ true true always maven-central maven-central http://central.maven.org/maven2/ true true always
通过配置 activeProfiles 子节点激活
boundlessgeo aliyun maven-central
如果在IDE里,记得要更新生效,然后就可以了。
2> 方法二
在项目中添加多个仓库,是通过修改项目中的pom文件实现的。
思路:在项目中pom文件的repositories节点(如果没有手动添加)下添加多个repository节点,每个repository节点是一个仓库。
jboss-repository jboss repository http://repository.jboss.org/nexus/content/groups/public-jboss/ aliyun-repository aliyun repository http://maven.aliyun.com/nexus/content/groups/public/ 奇葩仓库 https://奇葩仓库/public/
到此这篇关于maven 配置多个仓库的方法的文章就介绍到这了,更多相关maven 多个仓库配置内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!