maven配置多个镜像

问题场景

1、国内访问maven默认远程中央镜像特别慢

2、用阿里的镜像替代远程中央镜像

3、大部分jar包都可以在阿里镜像中找到,部分jar包在阿里镜像中没有,需要单独配置镜像

解决方案

1,在全局配置文件setting.xml,只配置一个中央仓库的镜像,即mirrorOf为central的镜像只配置一个

2、在具体项目的pom.xml文件里配置特殊的仓库

具体pom.xml文件配置如下:






    
        ssm-parent
        cn.itcast
        1.0-SNAPSHOT
        ../ssm-parent/pom.xml
    
    4.0.0

    cn.itcast
    ssm-crm
    1.0-SNAPSHOT
    war

    ssm-crm Maven Webapp
    
    http://www.example.com

    
        UTF-8
        1.7
        1.7
    

    
        
            nexus-163
            Nexus 163
            http://mirrors.163.com/maven/repository/maven-public/
            default
            
                false
            
            
                true
            
        
    



    
        
            junit
            junit
            4.11
            test
        

        
            org.apache.taglibs
            taglibs-standard-spec
            1.2.5
        
        
            org.apache.taglibs
            taglibs-standard-impl
            1.2.5
        
    

   




阿里云镜像


    
      alimaven
      aliyun maven
      http://maven.aliyun.com/nexus/content/groups/public/
      central        
    
  

网易镜像

https://mirrors.163.com/.help/maven.html


    
        nexus-163
        Nexus 163
        http://mirrors.163.com/maven/repository/maven-public/
        default
        
            false
        
        
            true
        
    

 

 

你可能感兴趣的:(MAVEN)