maven项目打包:maven-surefire-plugin:2.18.1:test (default-test) on project agent_api: There are test fail

在项目打包中遇到的问题,
问题 :Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project agent_api: There are test failures.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project agent_api: There are test failures.
[ERROR]
[ERROR] Please refer to E:\gitRep\agentapi\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

解决思路
1 在出现这个错误的时候我的第一印象是项目中包没有下全吧,可能是由于jar包的关系导致的不成功,我用的开发工具是idea,打开maven project看了一下没有发现jar包存在问题,
2 不是jar包的问题难道是我项目分支的问题, 我用的打包命令是mvn install。但是这个简单的项目是用springboot没有区分test,dev,prod分支啊,配置文件中区分的打那个分支的包,检查了一下,也不是分支的问题
3 看下上面的报的问题吧,也许他会给我灵感
maven项目打包:maven-surefire-plugin:2.18.1:test (default-test) on project agent_api: There are test fail_第1张图片
报错的问题中有几个关键点test测试,还给了一个tager路径,我在项目中找到这个tager路径并打开一看全是我的单元测试。看到这里的时候我想难道是我的单元测试中有问题么,如果单元测试中有问题上面的打印日志会报错的啊,我就往上翻翻看,果然
maven项目打包:maven-surefire-plugin:2.18.1:test (default-test) on project agent_api: There are test fail_第2张图片
这是我单元测试中69行报错了null所以导致了打包失败,到这里错误就找到了,单元测试中如果有错误问题打包时会引起Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project agent_api: There are test failures.

结果演示
maven项目打包:maven-surefire-plugin:2.18.1:test (default-test) on project agent_api: There are test fail_第3张图片

你可能感兴趣的:(遇见过的问题)