版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Carrots_vegetables/article/details/82891170
今天在新建项目导包的时候出现了下面的错误(原本好好的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