我正在尝试从 Maven 2 切换到 Maven 3 (v3.0.4)。使用的基本命令是 jenkins 上的 mvn clean verify。
当我在 jenkins 上运行构建时,我在它的控制台上得到以下堆栈跟踪:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
<snip />
Waiting for Jenkins to finish collecting data
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.12:verify (default) on project myProject: There are test failures.
Please refer to /home/tc/.jenkins/jobs/myProject-selenium-adhoc/workspace/target/failsafe-reports for the individual test results.
cause : There are test failures.
Please refer to /home/tc/.jenkins/jobs/myProject-selenium-adhoc/workspace/target/failsafe-reports for the individual test results.
Stack trace :
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.12:verify (default) on project myProject: There are test failures.
Please refer to /home/tc/.jenkins/jobs/myProject-selenium-adhoc/workspace/target/failsafe-reports for the individual test results.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:98)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:64)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:287)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.
Please refer to /home/tc/.jenkins/jobs/myProject-selenium-adhoc/workspace/target/failsafe-reports for the individual test results.
at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:121)
at org.apache.maven.plugin.failsafe.VerifyMojo.execute(VerifyMojo.java:208)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 27 more
Maven failed with error.
Sending e-mails to: person@org.com
channel stopped
2012-07-11 21:01:31.564:INFO::Shutdown hook executing
2012-07-11 21:01:31.564:INFO::Shutdown hook complete
Archiving artifacts
Sending e-mails to: person@org.com
Finished: SUCCESS
我已经尝试在网上非常努力地搜索,尝试各种 pom 更改并使用 -e、-X、-fae 等运行 maven,但似乎没有什么能让我摆脱这个堆栈跟踪 :( .. 一直在苦苦挣扎现在几天。
任何能够提供一些建议和/或通过解决方案指出问题的人将不胜感激。
请注意,该项目的组织方式如下:
Parent pom
|
----------> module 1
----------> module 2
----------> ...
----------> module 6
其中模块 6 对应于上面的 myProject,它依赖于一些库(即模块 1、模块 2 等)。
父 pom 有:
<reporting>
<plugins>
{ several plugins including maven-dependency-plugin, maven-project-info-reports-plugin, cobertura-maven-plugin, maven-surefire-report-plugin (v2.12)
and maven-surefire-report-plugin (v2.12) specifically w/
<reportSets>
<reportSet>
<id>integration-tests</id>
<reports>
<report>failsafe-report-only</report>
</reports>
</reportSet>
</reportSets>
}
</plugins>
<reporting>
和
<build>
<pluginManagement>
<plugins>
{several plugins including maven-surefire-plugin, maven-surefire-report-plugin (v2.12), maven-assembly-plugin, maven-release-plugin (v2.3.2)
</plugins>
</pluginManagement>
<plugins>
{several plugins including maven-site-plugin (v3.1), maven-compiler-plugin (v2.5.1), maven-release-plugin (v2.3.2)
</plugins>
</build>
另请注意,当测试失败时,我会准确地看到问题,即当测试失败时,我想获得一个干净的(没有堆栈跟踪等)控制台输出。事实上,在我上面提到的故障排除过程中,我实际上设置了一个(故意)失败的测试。此外,当我查看“/home/tc/.jenkins/jobs/myProject-selenium-adhoc/workspace/target/failsafe-reports”时,故障安全报告/测试失败详细信息输出看起来不错,即我看到了预期的测试失败屏幕截图(我们框架中的自定义逻辑)以及各种摘要/报告,例如具有正确内容的 emailable-report.html。
谢谢 !