zoukankan      html  css  js  c++  java
  • Maven

    通常我们会因为下载jar包速度缓慢而苦恼,这十分影响开发效率,以及程序员的心情,在IDE下载jar时,无法对IDE做任何动作,只能大眼对小眼。

    下载jar速度慢究其原因就是因为很多资源都是国外的,我们下载一个小文件几乎就跨越了一个太平洋那么远,那么有什么方法可以让下载速度变快呢?

    其实方法很简单:maven是支持镜像的,我们可以在${maven_home}的conf目录下的setting.xml文件中找到<mirrors></mirrors>标签

    <mirrors>  
        <!-- mirror  
         | Specifies a repository mirror site to use instead of a given repository. The repository that  
         | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used  
         | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.  
         |  
        <mirror>  
          <id>mirrorId</id>  
          <mirrorOf>repositoryId</mirrorOf>  
          <name>Human Readable Name for this Mirror.</name>  
          <url>http://my.repository.com/repo/path</url>  
        </mirror>  
         -->  
          
      </mirrors>  

    在这个标签中加入国内的镜像即可

    这里我推荐maven阿里云中央仓库

    <mirrors>
        <mirror>
          <id>alimaven</id>
          <name>aliyun maven</name>
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>        
        </mirror>
      </mirrors>
    <mirror>  
     <id>alimaven</id>  
     <mirrorOf>central</mirrorOf>  
     <name>aliyun maven</name>  
     <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>  
    </mirror> 

     下面是一些常用的maven国内镜像

    <mirror>  
          <id>CN</id>    
          <name>OSChina Central</name>                                                                                                                           
          <url>http://maven.oschina.net/content/groups/public/</url>    
          <mirrorOf>central</mirrorOf>  
        </mirror>  
        <mirror>      
              <id>repo2</id>      
              <mirrorOf>central</mirrorOf>      
              <name>Human Readable Name for this Mirror.</name>      
              <url>http://repo2.maven.org/maven2/</url>      
        </mirror>      
        <mirror>      
              <id>net-cn</id>      
              <mirrorOf>central</mirrorOf>      
              <name>Human Readable Name for this Mirror.</name>      
              <url>http://maven.net.cn/content/groups/public/</url>       
        </mirror>      
        <mirror>      
              <id>ui</id>      
              <mirrorOf>central</mirrorOf>      
              <name>Human Readable Name for this Mirror.</name>      
             <url>http://uk.maven.org/maven2/</url>      
        </mirror>      
        <mirror>      
              <id>ibiblio</id>      
              <mirrorOf>central</mirrorOf>      
              <name>Human Readable Name for this Mirror.</name>      
             <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>      
        </mirror>      
        <mirror>      
              <id>jboss-public-repository-group</id>      
              <mirrorOf>central</mirrorOf>      
              <name>JBoss Public Repository Group</name>      
             <url>http://repository.jboss.org/nexus/content/groups/public</url>      
        </mirror>    
            
            
        <mirror>      
              <id>JBossJBPM</id>  
              <mirrorOf>central</mirrorOf>  
              <name>JBossJBPM Repository</name>  
              <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>  
        </mirror>  
             <mirror>      
              <id>antelink</id>  
              <mirrorOf>central</mirrorOf>  
              <name>antelink Repository</name>  
              <url>http://maven.antelink.com/content/repositories/central/</url>  
        </mirror>  
        <mirror>      
              <id>openkoala</id>  
              <mirrorOf>central</mirrorOf>  
              <name>openkoala Repository</name>  
              <url>http://nexus.openkoala.org/nexus/content/groups/Koala-release/</url>  
        </mirror>  
        <mirror>      
              <id>tmatesoft</id>  
              <mirrorOf>central</mirrorOf>  
              <name>tmatesoft Repository</name>  
              <url>http://maven.tmatesoft.com/content/groups/public/</url>  
        </mirror>  
        <mirror>      
              <id>mavensync</id>  
              <mirrorOf>central</mirrorOf>  
              <name>mavensync Repository</name>  
              <url>http://mavensync.zkoss.org/maven2/</url>  
        </mirror> 
  • 相关阅读:
    C++之友元机制(友元函数和友元类)
    C++之全局函数和成员函数互相转换
    C++之面向对象初探----对象管理模型(关键是this指针)
    C++之const类成员变量,const成员函数
    C++之static类成员,static类成员函数
    c++之函数值传递和引用传递解析----关键在于理解函数return的实现机制(内存分配)
    C++之new和delete
    C++之构造函数、参数列表、析构函数
    C++之匿名对象解析
    C结构体、C++结构体、C++类的区别
  • 原文地址:https://www.cnblogs.com/davidgu/p/6187207.html
Copyright © 2011-2022 走看看