解决Maven下载速度缓慢问题

时间:2020-02-13 20:02:21 类型:JAVA
字号:    

  使用IDEA和Eclipse开发maven项目时,maven在添加一项新的依赖时,如果发现本地仓库没有,就会向位于国外服务器的中央仓库下载,网络访问不到中央仓库导致无法下载或下载过慢,这样的下载速度会慢到你想砸电脑。推荐使用阿里的镜像,速度杠杆的。

  配置方法如下:

  第一步:找到自己安装maven的路径,选择setting.xml

  第二步:打开setting.xml文件,找到mirrors节点添加阿里镜像库地址:

       <mirror>  
            <id>nexus-aliyun</id>  
            <mirrorOf>central</mirrorOf>  
            <name>Nexus aliyun</name>  
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
        </mirror>

  第三步:在开发工具(IDE或者eclipse)中重新选择一下maven的setting.xml,重启IDE,你会发现速度杠杠的。


<