故障安全插件不会在一个项目上运行,而会在另一个项目上运行-为什么? [英] failsafe plugin won't run on one project but will run on another -- why?
问题描述
这让我发疯. Maven故障安全插件将无法在我的项目上运行.如果我运行mvn verify
,则只能运行surefire.如果键入mvn failsafe:verify
,它将失败,并显示以下错误:
This is driving me insane. The Maven failsafe plugin will not run on my project. If I run mvn verify
only surefire runs. If I type mvn failsafe:verify
it fails with the following error:
[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出色的
It's complaining about not finding failsafe-summary.xml
. But this should be created by the plugin. And the plugin works fine (and creates the failsafe-summary.xml
file if I run run Antonio Goncalves wonderful Arquillian example project.
因此,我复制了Antonio使用的确切插件信息,但仍无法在我的项目中运行.我已经将我的POM建模为与他完全一样(除非没有父母pom)-一定有问题,我只是不知道什么.为什么要在他的项目上运行故障保护而不是在我的项目上运行?
So I copied the exact plugin information Antonio uses, and it still won't run on my project. I've modelled my POM to be exactly like his (except without a parent pom) -- something must be going wrong, I just don't know what. Why will failsafe run on his project but not mine??
这是我的故障安全pom.xml条目,该条目直接取自他,并且与故障安全usaages站点上的条目相同:
Here is my failsafe pom.xml entry, which is taken right from his, and is the same as the one on the failsafe usaages site):
<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>
感谢您的帮助,这让我发疯了.
Thanks for any help, this is driving me insane.
更新好的,我似乎已经解决了cannot find failsafe-summary.xml
问题-我将目录从experiment_server
更改为experiment-server
.我猜这搞砸了故障保险.
UPDATE Okay, I seem to have gotten the cannot find failsafe-summary.xml
problem fixed -- I change my directory from experiment_server
to experiment-server
. I guess that messes up failsafe.
但是,我仍然无法从命令mvn verify
或mvn integration-test
运行故障保护来运行.这两个命令都调用surefire而不是故障安全.我现在可以使用以下命令直接运行故障保护:mvn failsafe:integration-test
,但是故障保护是否不应该自动使用mvn verify
运行?我的mvn help:effective-pom
显示故障保护在那里,所以这不是问题……有什么想法吗?
But, I'm still having trouble getting failsafe to run from the command mvn verify
or mvn integration-test
. Both those commands call surefire instead of failsafe. I can now run failsafe directly by using the command: mvn failsafe:integration-test
, but shouldn't failsafe automatically run with mvn verify
? My mvn help:effective-pom
shows that failsafe is there, so that's not the problem... Any ideas?
推荐答案
Take a look at the failsafe docs for the test names failsafe
expects by default:
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
您的测试是否按照这些模式之一命名?如果不是,请尝试在插件配置中定义<includes>
元素.或更改您的测试名称以适合默认模式.
Are your tests named following one of these patterns? If not, try defining the <includes>
element in the plugin configuration. Or change your test name(s) to fit the default pattern.
好吧,现在我们已经验证了测试类的名称-通常,当我将执行添加到插件配置中时,我会执行以下操作:
Okay, now that we've verified the test class names - typically when I add executions to plugin config I do it something like this:
<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>
这将您要运行的failsafe
插件目标明确绑定到构建生命周期的正确阶段.我相信surefire
插件默认情况下绑定到test
生命周期阶段(无论如何对于jar,war和& ejb),但没有任何内容绑定到integration-test
或verify
.
This explicitly binds the failsafe
plugin goals you want to run to the correct phases of the build lifecycle. I believe the surefire
plugin is bound to the test
lifecycle phase by default (for a jar, war, & ejb anyway), but nothing is bound to integration-test
or verify
.
这篇关于故障安全插件不会在一个项目上运行,而会在另一个项目上运行-为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!