Maven故障安全插件不会在我的项目上运行。如果我运行mvn验证只有surefire运行。如果我键入mvn failsafe:验证它失败并出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.11:verify (default-cli) on project experiment-server: /home/user/workspace/MyProject-Main/MyProject-IntegrationTest/target/failsafe-summary.xml (The system cannot find the path specified) -> [Help 1]
所以我基本上遇到了同样的问题:failsafe plugin won't run on one project but will run on another -- why? 不同的是,我的pom已经看起来像这样:
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.14.1</version>
<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>
这就是这个家伙问题的解决方案。除了这个网站上的解决方案对我不起作用。有人能说出我搞砸了的地方吗?
我还有一个问题,我想在预集成阶段使用exec-maven-plugin启动服务器。但是,当我尝试mvn-verify时,它是最后执行的事情。
答案 0 :(得分:5)
刚刚找到这个,解决方案在这里:http://maven.apache.org/surefire/maven-failsafe-plugin/plugin-info.html
maven-failsafe-plugin,例如,与maven-compiler-plugin相反,不在默认的maven构建生命周期中。
因此,必须尊重这个标签层次结构:
<project>
<build>
<pluginManagement>
<plugins>
<!-- For understanding only, below is the 'maven-compiler-plugin':
its path is 'project -> build -> pluginManagement -> plugins
-> plugin', because it's defaulty part of the maven build
lifecycle: we just 'manage' it -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
..
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- HERE is the 'maven-failsafe-plugin':
its path is 'project -> build -> plugins ->
plugin', because it's NOT defaulty part of
the maven build lifecycle: we have to
'define' it, and not just manage it as
stated earlier -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
..
</plugin>
</plugins>
</build>
<project>
从官方文档链接引用:“在父POM中定义插件版本”和“在POM或父POM中使用插件目标”。必须注意差异。
答案 1 :(得分:1)
我将故障保护的pom片段移动到父母的pom上,这似乎就是这个伎俩。我不知道为什么。