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/
修改为jdk下的jre
image.png
3.提示org.junit不存在
image.png
eclipse默认工程3.8.1,修改pom.xml文件为4.11
mvn test 成功
mven test成功后,run as testng 通过
image.png
可在testng.xml中配置需执行的测试方法
网友评论