我尝试在maven中获得一个简单的有效登录测试版本,以便稍后在jenkins服务器中运行。
事情是:每次我构建(干净安装)我都会收到以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project validLogin: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Me\workspace\validLogin\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
我在这里失去了我的头发,如何解决这个问题? (错误不是头发)
答案 0 :(得分:2)
您的构建有失败的测试需要修复。要查看哪些测试失败,请在pom.xml的surefire插件配置部分中,检查printSummary选项是否设置为 true 。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<printSummary>true</printSummary>
</configuration>
</plugin>
设置此选项后,您应该在命令行输出中看到完整的测试结果列表(包括失败)。
测试失败也列在 C:\ Users \ Me \ workspace \ validLogin \ target \ surefire-reports
中答案 1 :(得分:2)
您可以使用
mvn clean install -DskipTests
如果您不希望它们被执行,请跳过测试。