failsafe插件不会在一个项目上运行但会在另一个项目上运行 - 为什么?

Chr*_*ile 7 pom.xml maven maven-failsafe-plugin

这让我疯了.Maven故障安全插件不会在我的项目上运行.如果我mvn verify只运行surefire运行.如果我键入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
Run Code Online (Sandbox Code Playgroud)

它抱怨没有找到failsafe-summary.xml.但这应该由插件创建.插件工作正常(failsafe-summary.xml如果我运行安东尼奥Goncalves精彩的Arquillian示例项目,则创建文件.

所以我复制了Antonio使用的确切插件信息,但它仍然无法在我的项目上运行.我已经将我的POM建模为与他完全一样(除了没有父母pom) - 一定是出错了,我只是不知道是什么.为什么故障保险会在他的项目上运行而不是我的项目?

这是我的故障安全pom.xml条目,它是从他的,并且与故障安全的网站上的那个相同):

<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>
Run Code Online (Sandbox Code Playgroud)

感谢您的帮助,这让我感到疯狂.

更新好的,我似乎已经解决了cannot find failsafe-summary.xml问题 - 我将目录从更改experiment_serverexperiment-server.我猜这会弄乱失败.

但是,我仍然无法通过命令运行故障安全mvn verifymvn integration-test.这两个命令都会调用surefire而不是failafe.我现在可以使用命令直接运行故障保护:mvn failsafe:integration-test,但是不应该自动运行故障保险mvn verify?我的mvn help:effective-pom表明故障保险是存在的,所以这不是问题......任何想法?

use*_*849 12

请查看默认情况下测试名称所需的故障安全文档failsafe:

<includes>
  <include>**/IT*.java</include>
  <include>**/*IT.java</include>
  <include>**/*ITCase.java</include>
</includes>
Run Code Online (Sandbox Code Playgroud)

您的测试是否遵循其中一种模式命名?如果没有,请尝试<includes>在插件配置中定义元素.或者更改您的测试名称以适合默认模式.


好的,现在我们已经验证了测试类名称 - 通常当我向插件配置添加执行时,我会这样做:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>${version.maven.failsafe.plugin}</version>
    <configuration>
    </configuration>
    <executions>
        <execution>
            <id>failsafe-integration-tests</id>
            <phase>integration-test</phase>
            <goals>
                <goal>integration-test</goal>
            </goals>
        </execution>
        <execution>
            <id>failsafe-verify</id>
            <phase>verify</phase>
            <goals>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

这会明确地将failsafe您要运行的插件目标绑定到构建生命周期的正确阶段.我相信surefire插件test默认绑定到生命周期阶段(无论如何,对于jar,war和ejb),但没有任何约束integration-testverify.