栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

maven 配置多个仓库的方法

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

maven 配置多个仓库的方法

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 多个仓库配置内容请搜索考高分网以前的文章或继续浏览下面的相关文章希望大家以后多多支持考高分网!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/132226.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号