0

我正在尝试将 emma 添加到项目构建中。我在这里浏览了教程 - Maven emma plugin

但我无法弄清楚如何指定要生成哪种报告 - 我的意思是 txt 或 xml。如何将此部分添加到 maven 构建中,以便在构建 POM 文件时,它会在某个特定目录中生成 txt 或 xml 报告。

4

2 回答 2

0

您可以使用 emma4it-maven-plugin 进行报告。1.3 版本有一些问题。但是 1.4-SNAPSHOT 工作正常。这是相同的 git 链接:https ://github.com/billmag/emma4it-maven-plugin.git 克隆 repo 并执行 mvn clean install。

如果您不想使用 SNAPSHOT 版本,也可以使用 1.2 版本。

The configuration in pom for reporting is as follows:
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.sonatype.maven.plugin</groupId>
                <artifactId>emma4it-maven-plugin</artifactId>
                <version>1.4-SNAPSHOT</version>
                <configuration>
                     <verbosity.level>verbose</verbosity.level>
                     <metadatas>coverage.em path</metadatas>
                     <instrumentations>coverage.ec path</instrumentations>
                     <reportDirectory>target/emma/</reportDirectory>
                     <baseDirectory>${project.basedir}/target</baseDirectory>
                     <formats>xml,html</formats>
                </configuration>
            </plugin>
       </plugins>
    </reporting>

Command to get the reports 
mvn org.sonatype.maven.plugin:emma4it-maven-plugin:1.4-SNAPSHOT:report
于 2013-07-01T10:35:26.537 回答
0

该功能已包含在 Sonatype Emma Plugin 的开发版本 emma-maven-plugin-1.3-SNAPSHOT 中,但尚未发布。

https://github.com/sonatype/emma-maven-plugin/pull/1

https://github.com/sonatype/emma-maven-plugin/pull/2

请注意,这与您在问题中引用的 Codehaus Emma 插件不同,但更改应该很小。

1.3 版发布后,您应该能够将以下内容放入 pom.xml 文件的报告部分,以获得完整的输出格式:

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.sonatype.maven.plugin</groupId>
                <artifactId>emma-maven-plugin</artifactId>
                <version>1.3</version>
                <configuration>
                    <formats>html,xml,txt</formats>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
于 2012-02-29T02:20:42.303 回答