当我运行命令mvn cobertura:cobertura
时,我想在检测和测试之间做一些事情。
此命令中的目标"cobertura"最初取决于"仪器",我想要的是在这个"仪器"过程之后执行,然后运行测试我的想法是将我的需求抽象成一个 Maven 插件,称为"my-plugin",有没有办法让它在两个 Cobertura 目标(仪器、测试(之间运行
您需要定义 cobertura 插件的两个执行,可以像下面这样实现:
<plugin>
<groupId>...</groupId>
<artifactId>..</artifactId>
<version>...</version>
<executions>
<execution>
<id>instrument</id>
<goals><goal>instrument</goal></goals>
<phase>process-test-classes</phase>
</execution>
<execution>
<id>test</id>
<goals><goal>cobertura</goal></goals>
<phase>test</phase>
</execution>
</executions>
</plugin>