1. 程式人生 > >Maven工程錯誤 之 Failure to transfer org.codehaus.plexus:plexus-archiver:pom:1.0

Maven工程錯誤 之 Failure to transfer org.codehaus.plexus:plexus-archiver:pom:1.0

最近建立了一個Maven 的web專案,匯入myeclipse中後,pom.xml檔案一直報如下錯誤

Failure to transfer org.codehaus.plexus:plexus-archiver:pom:1.0 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not 
 be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not
transfer artifact org.codehaus.plexus:plexus- archiver:pom:1.0 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/org/codehaus/plexus/ plexus-archiver/1.0/plexus-archiver-1.0.pom

後來檢視網上資料,好多都說用如下方法解決

  1. 先去掉Maven工程的maven特性,選中工程 滑鼠右鍵–>Maven–>Disable Maven Nature
  2. 為工程增加Maven特性,選中工程 滑鼠右鍵–>Configure–>Convert to Maven Project

親測沒有解決問題,後來無奈就去maven倉庫下載了plexus-archiver-1.0.jar放在本地maven倉庫中,本想應該可以了結果又報

Failure to transfer org.codehaus.plexus:plexus-archiver:jar:1.2 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not
be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus- archiver:jar:1.2 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000

同樣又把plexus-archiver-1.2.jar下載放在本地maven倉庫中,結果又報

Failure to transfer org.codehaus.plexus:plexus-io:jar:1.0.1 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be 
 reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-io:jar:
 1.0.1 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000

2017-05-03更新 多謝五樓網友qklp的建議,希望對後續童鞋有所幫助

在maven 的setting.xml檔案中找到<mirrors>新增如下內容

<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<!-- 阿里雲倉庫 -->

Maven設定新增阿里雲倉庫, 然後重啟ecplise,更新專案,問題解決