这篇文章主要介绍了maven 配置多个仓库的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
1>方法一
之前在配置 Maven 的 settings.xml 时,都会设置 mirror 节点,例如:
alimavenaliyun mavenhttp://maven.aliyun.com/nexus/content/groups/public/central
然后第一想法就是在 mirrors 节点下多增加几个 mirror,然而并不可以。正确的操作是在 profiles 节点下配置多个 profile,而且配置之后要激活。例如:
配置profiles
boundlessgeo boundlessgeohttps://repo.boundlessgeo.com/main/ true truealways aliyun aliyunhttp://maven.aliyun.com/nexus/content/groups/public/ true truealways maven-central maven-centralhttp://central.maven.org/maven2/ true truealways
通过配置 activeProfiles 子节点激活
boundlessgeoaliyunmaven-central
如果在IDE里,记得要更新生效,然后就可以了。
2> 方法二
在项目中添加多个仓库,是通过修改项目中的pom文件实现的。
思路:在项目中pom文件的repositories节点(如果没有手动添加)下添加多个repository节点,每个repository节点是一个仓库。
<!-- id必须唯一 -->jboss-repositoryjb<a style="color:transparent">来源gao($daima.com搞@代@#码网</a>oss repositoryhttp://repository.jboss.org/nexus/content/groups/public-jboss/ aliyun-repositoryaliyun repositoryhttp://maven.aliyun.com/nexus/content/groups/public/ 奇葩仓库https://奇葩仓库/public/
到此这篇关于maven 配置多个仓库的方法的文章就介绍到这了,更多相关maven 多个仓库配置内容请搜索gaodaima搞代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持gaodaima搞代码网!
以上就是maven 配置多个仓库的方法的详细内容,更多请关注gaodaima搞代码网其它相关文章!