Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.18.1

问题描述

eclipse 导入一个 Maven 工程时,pom.xml 文件第一行的XML文档声明处报错,红叉处提示如下错误:

Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.18.1 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-compiler-plugin:pom:2.18.1 from/to central (https://repo.maven.apache.org/maven2): 
connect timed out pom.xml /pay-core-baixin-api line 1 Maven Configuration Problem

问题原因

从错误提示看到,maven-compiler-plugin:pom:2.18.1 从maven网上下载失败是由于本地仓库已经有该插件的缓存了,搜索了该文件后才知道在另一个本地仓库路径下有缓存该插件。

解决方法

1、首先删掉另一个本地仓库已缓存的 ~.m2\repository\org\apache\maven\plugins\maven-surefire-plugin\2.18.1 目录;

2、然后通过 maven->update projects,勾上 force update of snapshots/releases ,更新工程即可。

所以本地的maven仓库最好只设置一个。




猜你喜欢

转载自blog.csdn.net/zhouxukun123/article/details/79589477