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

Tom*_*art 2 java ant code-coverage emma report

我有一个问题,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>
Run Code Online (Sandbox Code Playgroud)

制作instr

    <target name="instr" depends="compile">  
        <emma>  
          <instr instrpathref="build.classpath"  
                 destdir="${instr}"
                 metadatafile="${coverage}/metadata.emma"  
                 merge="true"  
          />  
        </emma>  
    </target>
Run Code Online (Sandbox Code Playgroud)

设置属性

    <jvmarg value="-Demma.coverage.out.file=${coverage}/coverage.emma" />  
    <jvmarg value="-Demma.coverage.out.merge=true" />
Run Code Online (Sandbox Code Playgroud)

报告

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

            <html outfile="${coverage}/coverage.html"/>             
        </report>      
    </emma>
Run Code Online (Sandbox Code Playgroud)

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

 [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:\...] ...   
Run Code Online (Sandbox Code Playgroud)

我想在报告中看到我的源代码,我该如何解决?我研究了艾玛的文档,遗憾的是没有任何与此问题相关的内容.

谢谢你的回答.

Tom*_*art 5

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

我添加debug="true"到javac,它现在有效.