Maven報錯:Failure to transfer org.apache.maven
在創建Maven項目時,經常會在pom.xml的第一行處報錯,提示信息如下:
Failure to transfer org.apache.maven:maven-surefire-plugin:jar:2.5 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.apache.maven:maven-
archiver:jar:2.5 from/to central (http://repo.maven.apache.org/maven2): The
operation was cancelled.
其主要的原因是因為maven的plugin並未下載到本地
解決問題的辦法很簡單:
步驟一:你可以到本地庫中搜索“.lastUpdated”結尾的文件並且刪除
1.進入dos窗口
2.進入本地倉庫文件夾下執行命令: del *.lastUpdated /s /f /q
步驟二: 回到項目中,在項目右鍵點擊project -> Maven -> Update Dependencies(Update Project…)更新項目,這時候應該就沒有錯了。