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

发布于 2024-12-19 23:11:50 字数 243 浏览 3 评论 0原文

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

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

I am trying to add emma to project build. I went through the tutorials here -
Maven emma plugin

But i am not able to figure out how do I specify what kind of reports to generate - i mean txt or xml. How do I add this part to the maven build so that when the POM file builds it generates either txt or xml report in some specific directory.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

-黛色若梦 2024-12-26 23:11:51

该功能已包含在 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>

The functionality has been included in the development version of the Sonatype Emma Plugin, emma-maven-plugin-1.3-SNAPSHOT, but it has not been released yet.

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

and

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

Note that this is not the same as the Codehaus Emma plugin that you referenced in your question, but the change should be minimal.

Once version 1.3 is released, you should be able to put the following in the reporting section of your pom.xml file to get the full range of output formats:

    <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>
婴鹅 2024-12-26 23:11:51

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

如果您不想使用 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

You can use the emma4it-maven-plugin for reporting. The 1.3 version has some issue.
But the 1.4-SNAPSHOT works fine.
Here is the git link for the same : https://github.com/billmag/emma4it-maven-plugin.git
Clone the repo and do a mvn clean install.

Also you can use 1.2 version in case you don't want to use a SNAPSHOT version.

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文