How to get line by line coverage xml file in Emma- maven project

倖福魔咒の 提交于 2021-02-08 08:42:13

问题


I am using the Emma tool in Maven project. Emma creates line by line code coverage in HTML file, it does not display line by line code coverage XML file. It gives only a summary XML file. Is there a way to keep or generate line by line code coverage XML file in Emma?

I have entered following plugin in my pom.xml

<reporting>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-project-info-reports-plugin</artifactId>
      <version>2.7</version>
      <configuration>
        <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
      </configuration>
    </plugin>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>emma-maven-plugin</artifactId>
      <version>1.0-alpha-3</version>
      <inherited>true</inherited>
    </plugin>
  </plugins>
</reporting>

Am I missing any configuration? If so where should I enter it in pom? (A complete pom.xml file will be appreciated).

I have created my project using Eclipse and ran it in cmd using the code:

mvn emma:emma

also i have entered following inside the Emma-maven pluggin

<configuration>
            <outputDirectory>${project.build.directory}</outputDirectory>
        </configuration>

回答1:


Yes, you can set the property maven.emma.report.xml to true to generate a XML report (it is false by default). The file target/coverage.xml will be generated.

Sample command:

mvn emma:emma -Dmaven.emma.report.xml=true


来源:https://stackoverflow.com/questions/33724313/how-to-get-line-by-line-coverage-xml-file-in-emma-maven-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!