2009-05-19 66 views
2

我有一個Ant和Emma代碼覆蓋插件的問題,它會生成報告,但沒有源代碼。Emma不會將源代碼嵌入到HTML報告中

我在我的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的文檔,但不幸的是沒有任何與這個問題有關的東西。

謝謝你的回答。

回答

5

好的,我解決了一個問題。

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

+0

+1解決你自己的問題。我只是想提出這個建議。 – Mark 2009-05-19 22:37:08