【发布时间】:2012-04-14 10:01:23
【问题描述】:
这让我发疯了。 Maven 故障保护插件不会在我的项目上运行。如果我运行mvn verify,则只有肯定会运行。如果我输入 mvn failsafe:verify 它会失败并出现以下错误:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simulation Experiment Server 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-failsafe-plugin:2.11:verify (default-cli) @ experiment-server ---
[INFO] Failsafe report directory: C:\IdeaProjects\experiment_server\target\failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.551s
[INFO] Finished at: Fri Mar 30 11:24:58 GMT-06:00 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.11:verify (default-cli) on project experiment-server: C:\IdeaProjects\experiment_server\target\failsafe-reports\failsafe-summary.xml (The system cannot find the path specified) -> [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/MojoExecutionException
它抱怨找不到failsafe-summary.xml。但这应该由插件创建。该插件运行良好(如果我运行 Antonio Goncalves 精彩 Arquillian example project,则会创建 failsafe-summary.xml 文件。
所以我复制了 Antonio 使用的确切插件信息,但它仍然无法在我的项目中运行。我已经将我的 POM 建模为与他的完全一样(除了没有父 pom)——一定是出了问题,我只是不知道是什么。为什么故障保护会在他的项目上运行,而不是我的??
这是我的failsafe pom.xml 条目,取自他的,与failsafe usaages 网站上的相同):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.maven.failsafe.plugin}</version>
<configuration>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
感谢您的帮助,这让我发疯了。
更新好的,我似乎已经解决了cannot find failsafe-summary.xml 的问题——我将我的目录从experiment_server 更改为experiment-server。我想这会破坏故障安全。
但是,我仍然无法通过命令 mvn verify 或 mvn integration-test 运行故障保护。这两个命令都调用surefire而不是failsafe。我现在可以使用以下命令直接运行故障安全:mvn failsafe:integration-test,但不应该使用mvn verify 自动运行故障安全吗?我的mvn help:effective-pom 表明存在故障保护,所以这不是问题...有什么想法吗?
【问题讨论】:
-
你运行哪个 Maven 版本?
-
可以在 IT 未运行的地方添加运行的输出吗?你是怎么称呼 Maven 的?
-
我运行 Maven 3.04。我不明白你在第二个问题中要问什么。你能改写一下吗?
-
郑重声明,
cannot find failsafe-summary.xml问题不是由于目录名称问题,而是由于缺少integration-test目标/阶段绑定。 -
大卫,你应该回答这个问题,因为你的解决方案是正确的
标签: maven pom.xml maven-failsafe-plugin