gpt4 book ai didi

integration-testing - maven-failsafe-plugin 不会在验证时运行,并且在故障安全 :verify 上找不到 xml

转载 作者:行者123 更新时间:2023-12-04 08:02:26 25 4
gpt4 key购买 nike

Maven 故障安全插件不会在我的项目上运行。如果我运行 mvn verify 只运行surefire。如果我输入 mvn failsafe:verify 它会失败并显示以下错误:

[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 时,它是执行的最后一件事。

最佳答案

刚刚发现这个,解决方案在这里:http://maven.apache.org/surefire/maven-failsafe-plugin/plugin-info.html

例如,与 maven-compiler-plugin 相反,maven-failsafe-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 中使用插件目标”。必须注意区别。

关于integration-testing - maven-failsafe-plugin 不会在验证时运行,并且在故障安全 :verify 上找不到 xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16615342/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com