代码之家  ›  专栏  ›  技术社区  ›  TomáÅ¡ Linhart

Emma不将源代码嵌入HTML报表

  •  2
  • TomáÅ¡ Linhart  · 技术社区  · 17 年前

    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的文档,不幸的是,没有任何与这个问题相关的内容。

    谢谢你的回答。

    1 回复  |  直到 17 年前
        1
  •  5
  •   TomáÅ¡ Linhart    17 年前

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

    我补充说 debug="true" 对于javac,它现在可以工作了。