首頁  >  問答  >  主體

在eclipse導入maven專案的時候卡住了,如何解決這個問題

我也知道這個是:由於某種原因,jar包下載不了,然後就一直卡著,求比較完整的解決方案?

阿神阿神2735 天前1683

全部回覆(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
  • 取消回覆