小编Vik*_*ria的帖子

如何为maven指定jacoco插件的输出格式?

我有一个带有 jacoco 插件的 Maven 项目,它生成不同格式的报告,例如 html、csv 和 xml。但我只需要 html。我怎样才能指定它?

这是一些代码,我在其中添加 jacoco 插件:

<build>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco.plugin.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    //other plugins
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

然后我运行测试:

mnv clean test
Run Code Online (Sandbox Code Playgroud)

所有报告都出现在“目标”目录中。

我阅读了文档https://www.eclemma.org/jacoco/trunk/doc/maven.html,但我没有找到任何有关如何选择所需格式的信息。我发现它只适用于 Ant 和 Gradle。

我想我错过了一些东西,所以我将不胜感激任何线索。

code-coverage maven jacoco jacoco-maven-plugin

8
推荐指数
3
解决办法
2万
查看次数