Maven + Clover + Jenkins - 如何在一个命令中获取Coverage报告和非检测工件

时间:2014-09-11 00:49:52

标签: java maven jenkins clover

我正在尝试运行maven clover插件来生成报告以及生成非检测工件。

<plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-clover2-plugin</artifactId>
            <version>3.1.3</version>
            <configuration>
                <generatePdf>true</generatePdf>
                <generateHtml>true</generateHtml>
                <licenseLocation>clover.license</licenseLocation>
                <!-- the contextFilters element has to be specified within the reporting section and will not work if you specify it in the build section. -->
                <!-- contextFilters>try,static,catch</contextFilters --> 
            </configuration>
        </plugin>


mvn clean clover2:instrument clover2:clover install

如果我根据clover doc instument运行上面目标将在单独的生命周期中运行,并且不会影响默认构建周期。所以确实如此,但问题是我想在默认构建生命周期中跳过测试。 我尝试了以下但是它跳过了生命周期的测试。

mvn clean clover2:instrument clover2:clover install -DskipTests

如果以上工作,那么我可以简单地在jenkins上设置它,为多个maven命令创建多个作业。

1 个答案:

答案 0 :(得分:2)

在单个神秘的maven命令中执行所有操作可能不是最好的主意(以同样的方式将所有代码放入过程中并不是最好的主意)。为什么不将命令分成几个步骤甚至是相互触发的作业?而且从CI的角度来看,不同类型的工作要求不同的优先级快速失败。我明白这不是一个答案。