java - Emma 没有将源代码嵌入到 html 报告中

标签 java ant code-coverage report emma

我对 Ant 和 Emma 代码覆盖率插件有疑问,它生成报告,但没有源代码。

我的 build.xml 中有以下代码

初始化艾玛

    <taskdef resource="emma_ant.properties" />   
    <path id="run.classpath">  
       <pathelement location="${instr}" />  
       <path  refid="build.classpath"/>  
       <pathelement path="${ant.home}/lib/junit-4.5.jar"/>  
       <pathelement path="${ant.home}/lib/emma.jar"/>  
    </path>

制作说明

    <target name="instr" depends="compile">  
        <emma>  
          <instr instrpathref="build.classpath"  
                 destdir="${instr}"
                 metadatafile="${coverage}/metadata.emma"  
                 merge="true"  
          />  
        </emma>  
    </target>

设置属性

    <jvmarg value="-Demma.coverage.out.file=${coverage}/coverage.emma" />  
    <jvmarg value="-Demma.coverage.out.merge=true" />

制作报告

    <emma>  
        <report sourcepath="${src}" >  
            <fileset dir="${coverage}" >  
                <include name="*.emma" />  
            </fileset>  

            <html outfile="${coverage}/coverage.html"/>             
        </report>      
    </emma>

这很好用。它输出到控制台:

 [report] processing input files ...
 [report] 2 file(s) read and merged in 10 ms
 [report] not all instrumented classes were compiled with source file
 [report] debug data: no sources will be embedded in the report.
 [report] line coverage requested in a report of type [html] but
 [report] not all instrumented classes were compiled with line number
 [report] debug data: this column will be removed from the report.
 [report] showing up to 3 classes without full debug info per package:
 [report]   ...
 [report] writing [html] report to [C:\...] ...   

我想在报告中查看我的源代码,我该如何修复它?我研究了 emma 的文档,不幸的是没有任何与这个问题相关的内容。

感谢您的解答。

最佳答案

好的,我解决了一个问题。

我将 debug="true" 添加到 javac,现在它可以工作了。

关于java - Emma 没有将源代码嵌入到 html 报告中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/885275/

相关文章:

ant - 在执行过程中对ant目标执行Gradle doFirst

android - 如何在构建时设置 strings.xml 值?

c# - PostSharp 和 Visual Studio 代码覆盖率

java - 如何使用 Servlet 将文件上传到数据库?

java - 在 Java 程序中使用 Apache Ant API 以编程方式构建源文件

java - 从Hive读取表格而没有 map 减少

c++ - C++ 库的 CodeCoverage 不会突出显示所有行

grails - 仅当覆盖率检查通过时才能成功构建 grails 项目

java - 如何更改 ResponseEntity 中的 JSON 响应格式?

java - 如何访问作为线程的一部分发生的异常信息?