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

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

今天在新建專案導包的時候出現了下面的錯誤(原本好好的Maven工程莫名的出現了這種錯誤),錯誤出現在pom.xml檔案的第一行
第一種錯誤

Failure to transfer org.codehaus.plexus:plexus-archiver:jar:2.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-archiver:jar:2.0.1 from/to central (http://repo.maven.apache.org/maven2): 
 No response received after 60000

第二種錯誤

Failure to transfer org.codehaus.plexus:plexus-io: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-io:pom:1.0 from/to central (http://repo.maven.apache.org/maven2): No 
response received after 60000

上面的兩個錯誤描述解決步驟是一樣的。

一、以第二種錯誤提示為例:

1.先去掉Maven工程的maven特性,選中工程 滑鼠右鍵–>Maven–>Disable Maven Nature. 此步驟後pom.xml錯誤消失

2.為工程增加Maven特性,選中工程 滑鼠右鍵–>Configure–>Convert to Maven Project.

經過上述步驟,Maven工程就正常了。
如果還不行
二、解決辦法:刪除掉下載失敗的jar

find ~/.m2 -name “*.lastUpdated” -exec grep -q “Could not transfer” {} ; -print -exec rm {} ;

windows下:

cd %userprofile%.m2\repository

for /r %i in (*.lastUpdated) do del %i