如果两个maven插件失败,是否有可能执行相同的生命周期?
示例:
假设我有下面的插件配置
<plugins>
<plugin>
<groupId>smothing</groupId>
<artifactId>plugin-1</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>doSomthing</id>
<phase>test</phase>
//...//
</plugin>
<plugin>
<groupId>something</groupId>
<artifactId>plugin-2</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>doSomthingAgain</id>
<phase>test</phase>
//...
</plugin>
</plugins>我想执行插件-2测试阶段,即使第一个插件失败。我不想忽视或跳过测试用例。
我有以下两个插件可以执行相同的阶段,即使一个失败。
<groupId>com.thoughtworks.gauge.maven</groupId>
<artifactId>gauge-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>基本上,经过测试之后,我想通过maven exec插件执行一些清理活动。那么,有什么选项可以让我总是执行maven exec插件呢?(没有命令行参数,这是我在pom.xml中所期望的)
我已经看到了这些答案,但是每件事都说要跳过测试用例。
How to run a maven goal when there is tests failures?
Maven reporting plugins do not execute if a unit test failure occurs
(任何值得赞赏的帮助:)
发布于 2019-02-23 16:50:59
如果插件失败,它将停止生命周期的执行。因此,您不应该考虑在某些情况下执行另一个插件来解决这个问题。根据您的描述,最好的方法似乎是编写一个扩展,请参阅https://maven.apache.org/examples/maven-3-lifecycle-extensions.html。使用https://maven.apache.org/ref/3.6.0/maven-core/apidocs/index.html?org/apache/maven/execution/AbstractExecutionListener.html,您可以看到您可以在生命周期的任何部分之前或之后执行操作,例如在projectSucceeded+projectFailed之后进行清理。
https://stackoverflow.com/questions/54842874
复制相似问题