问题:
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.7.1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-surefire-plugin:jar:2.7.1 in http://repo2.maven.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of repo2 has elapsed or updates are forced -> [Help 1]
在网络上找了N种方法,基本都试用过,全部失败,后面分析了,该jar包本地存在但是无法通过maven仓库远程下载,通过地址找不到此jar包,后面想到可能是镜像问题,于是在\maven\apache-maven-3.5.3\conf\setting.xml中添加了阿里云私服镜像
<!--配置阿里云maven私有仓库(即配阿里私服)-->
<mirror>
<id>alimaven</id>
<mirrorOf>*</mirrorOf>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
再执行点击maven test,控制台提示
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
中文描述:此环境中未提供编译器,你可能使用jre运行而不是jdk。
引发原因:Eclipse默认在jre上运行,maven install 编译需要jdk中的编译器,而jre中并没有
问题解决:
结果:
总结:
1)在pom.xml文件添加了依赖以后,本地jar已经下载好到本地,但是远程仓库无法下载,就添加一个新的镜像
2)点击maven test提示Perhaps you are running on a JRE rather than a JDK?
则按操作步骤继续