IDEA解决Maven下载依赖包速度慢问题

建立maven的webapp骨架项目时,会因为下载jar包速度缓慢而苦恼,这十分影响开发效率,以及开发者的心情,在IDE下载jar时,无法对IDE做任何动作,网络不好时甚至超过半小时下载时间,所以想到下载jar速度慢究其原因就是因为很多资源都是国外的,我们下载一个小文件几乎就跨越了一个太平洋那么远,那么有什么方法可以让下载速度变快呢?
1.maven是支持镜像的,我们可以在${maven_home}的conf目录下的setting.xml文件中找到标签在这里插入图片描述
在这个标签中加入国内的镜像即可,这里我比较喜欢推荐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> 

填写好,再次启动做项目就事半功倍!

猜你喜欢

转载自blog.csdn.net/qq_40771292/article/details/106574065