碰到了好幾次,剛導入的項目,pom.xml無法導入
依賴全部報紅
重新導入多次,都是一樣的結果
類似這樣的報錯:
Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.3.RELEASE from https://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.springframework.boot:spring-boot-starter-parent:pom:2.0.3.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connection reset
通過網上查詢,發現可能是因為各種原因(網速慢、斷網)導致jar包下載不下來,出現很多.lastUpdated文件。
而這些文件依然會導致jar包下載出錯。
解決辦法:
在CMD中
cd %userprofile%\.m2\repository for /r %i in (*.lastUpdated) do del %i
刪除所有的.lastUpdated文件,重新導入項目即可。