10

我有一个案例,我想在验证阶段和报告阶段都运行 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>

我也不想将其复制到报告部分,因为要复制的内容很多。有没有好的方法来完成这个?

谢谢,

杰夫

4

1 回答 1

10

定义这个:

<executions>
        <execution>
                <phase>verify</phase>
                <goals>
                        <goal>cobertura</goal>
                </goals>
        </execution>
        <execution>
                <phase>pre-site</phase>
                <goals>
                        <goal>cobertura</goal>
                </goals>
        </execution>
</executions>
于 2009-07-09T12:04:53.080 回答