有时候我们的maven工程的pom.xml文件第一行会报如下错误:
Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 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.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (https://repo.maven.apache.org/maven2):
The operation was cancelled.
可以尝试以下方法解决:
1.找到maven库目录,进入:\org\apache\maven\plugins\maven-surefire-plugin\2.12.4
2.若2.12.4目录下有maven-surefire-plugin-2.12.4.pom.lastUpdated文件,将其删除
3.项目右键–>maven–>Update Dependencies