使用maven配置emma以生成xml或文本报告

时间:2011-12-07 18:26:45

标签: maven emma

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

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

2 个答案:

答案 0 :(得分:0)

该功能已包含在Sonatype Emma插件的开发版本中,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>

答案 1 :(得分:0)

您可以使用emma4it-maven-plugin进行报告。 1.3版本有一些问题。 但1.4-SNAPSHOT工作正常。 以下是相同的git链接:https://github.com/billmag/emma4it-maven-plugin.git 克隆仓库并进行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
相关问题