首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Emma不会将源代码嵌入到html报告中

Emma不会将源代码嵌入到html报告中
EN

Stack Overflow用户
提问于 2009-05-19 22:06:14
回答 1查看 1.6K关注 0票数 2

我有一个问题,Ant和Emma是一个代码覆盖率插件,它可以生成报告,但没有源代码。

我的build.xml中有以下代码

初始化emma

代码语言:javascript
复制
    <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>

创建实例

代码语言:javascript
复制
    <target name="instr" depends="compile">  
        <emma>  
          <instr instrpathref="build.classpath"  
                 destdir="${instr}"
                 metadatafile="${coverage}/metadata.emma"  
                 merge="true"  
          />  
        </emma>  
    </target>

设置属性

代码语言:javascript
复制
    <jvmarg value="-Demma.coverage.out.file=${coverage}/coverage.emma" />  
    <jvmarg value="-Demma.coverage.out.merge=true" />

制作报告

代码语言:javascript
复制
    <emma>  
        <report sourcepath="${src}" >  
            <fileset dir="${coverage}" >  
                <include name="*.emma" />  
            </fileset>  

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

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

代码语言:javascript
复制
 [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的文档,不幸的是没有任何与这个问题相关的东西。

谢谢你的回答。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-05-19 22:36:13

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

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

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/885275

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档