首页  >  问答  >  正文

在eclipse导入maven项目的时候卡住了,如何解决这个问题

我也知道这个是:由于某种原因,jar包下载不了,然后就一直卡着,求比较完整的解决方案?

阿神阿神2735 天前1687

全部回复(2)我来回复

  • PHPz

    PHPz2017-04-24 09:15:59

    等等等。。。。。。。。。。。。。。。。。。。。。。。。。。等它下完!

    lz下载的资源是从http://repo.maven.apache.org/...的中央库下载!而这个地址是国外地址,在正常情况下,国内下载国外的资源相对来说是比较慢,但是也不会很慢,之所以这么慢,就得予以党给我们的‘保护’!哈哈哈。。。


    下面才是正文

    上面说了你为什么会卡!你用国外地址下载资源当然卡!不卡你卡谁???解决这个问题的根本就是改变下载资源的地址,把它改成国内的maven资源仓库(oschian.net、taobao.com、baidu.com等)。

    settings.xml

    把Maven的settings.xml里的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>nexus-osc</id>
            <mirrorOf>central</mirrorOf>
            <name>Nexus osc</name>
            <url>http://maven.oschina.net/content/groups/public/</url>
        </mirror>
        <mirror>
            <id>nexus-osc-thirdparty</id>
            <mirrorOf>thirdparty</mirrorOf>
            <name>Nexus osc thirdparty</name>
            <url>http://maven.oschina.net/content/repositories/thirdparty/</url>
        </mirror>
    </mirrors>

    回复
    0
  • 阿神

    阿神2017-04-24 09:15:59

    1、估计是网络问题,换一个仓库试试,比如阿里的,如下:

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

    2、换了之后建议删掉本地仓库里已经下载的全部jar包;

    回复
    0
  • 取消回复