maven-2 - 在多个生命周期中运行 Maven 目标

标签 maven-2 plugins profile

我有一个情况,我想在验证阶段和报告阶段运行 cobertura 插件。我有两个配置文件,它们都应该运行 cobertura 插件,但在配置文件 A 中,我只想创建 xml/html 输出,但在配置文件 B 中,我将生成包含这些结果的完整站点文档。

我将 cobertura 配置为作为验证阶段一部分运行的插件,但如果我这样做,即使我运行 mvn verify site,cobertura 报告也不会出现在站点文档中。似乎我需要将它列在插件和报告部分中(因为我不会在配置文件 A 中运行站点,所以如果我只在插件中拥有它,它就不会在该配置文件中被调用)。到目前为止,我的 POM 的插件部分包括:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin </artifactId>
<version>2.2</version>
<configuration>
    <instrumentation>
        <excludes>
            <exclude>com/somepkg/**</exclude>
        </excludes>
    </instrumentation>
    <formats>
        <format>xml</format>
        <format>html</format>
    </formats>
</configuration>        
<executions>
    <execution>
        <phase>verify</phase>
        <goals>
            <goal>cobertura</goal>
        </goals>
    </execution>
</executions>
</plugin>

我不想将其复制到报告部分,因为这需要重复很多。否则有什么好的方法可以实现这一点吗?

谢谢

杰夫

最佳答案

定义这个:

<executions>
        <execution>
                <phase>verify</phase>
                <goals>
                        <goal>cobertura</goal>
                </goals>
        </execution>
        <execution>
                <phase>pre-site</phase>
                <goals>
                        <goal>cobertura</goal>
                </goals>
        </execution>
</executions>

关于maven-2 - 在多个生命周期中运行 Maven 目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1103386/

相关文章:

ios - 为什么我的临时配置文件会过期?

maven-2 - maven tomcat 插件还是cargo 插件?

数字签名的 Java 插件替代品

plugins - CRM 2011 异步更新后插件

cocoa - .so 运行时可链接库作为插件; cocoa 能力?

python - 是否有用于 python 的统计分析器?如果没有,我怎么能写一个呢?

EJB 应用程序的 Java 分析器

java - 如何安装 Maven2 插件?

java - Maven 无法找到插件描述符

java - 管理大型 OSGi 应用程序