maven+eclipse报错解决

Run As Maven test时
1.提示deploy, compiler等错误,

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

是因为仓库中的版本不正确或以前下载出错,删除仓库中此文件夹,重新Maven->update project
C:\Users{username}.m2\repository\org\apache\maven\plugins

2.提示jre/../tools.jar不存在,修改项目的默认jre路径为/jdk/jre/


maven+eclipse报错解决_第1张图片
修改为jdk下的jre

maven+eclipse报错解决_第2张图片
image.png

3.提示org.junit不存在


maven+eclipse报错解决_第3张图片
image.png

eclipse默认工程3.8.1,修改pom.xml文件为4.11


maven+eclipse报错解决_第4张图片
mvn test 成功

mven test成功后,run as testng 通过


maven+eclipse报错解决_第5张图片
image.png

可在testng.xml中配置需执行的测试方法

你可能感兴趣的:(maven+eclipse报错解决)