---
title: "没有覆盖率分析报告 coverage 总结"
author: "netli"
date: "2011-01-17T17:29:31Z"
tags: []
categories: ["编程语言"]
slug: "coverage"
draft: false
lastmod: "2011-01-18T10:22:17Z"
id: 882452
url: "https://netli.iteye.com/blog/882452"
---

设置自定义HUDSON\_HOME启动

java -DHUDSON\_HOME=/path/to/home -jar hudson.war0 V! G$ r

### 1 junit运行期间 出错

### Error Message

Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.

**Stacktrace**

junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.

 

 解决 ： 1 更换ant 版本

             2 设置 ant 的 Java Options  -Xmx256m  内存调大

 

### 2  没有提前 instr

    &lt;target name="instr"&gt;  
    &lt;mkdir dir="${build.coverage.dir}"/&gt;  
        &lt;emma enabled="true"&gt;  
            &lt;instr destdir="${build.coverage.dir}"  
                   merge="false"  
                   outfile="${build.coverage.dir}/coverage.em"  
                   mode="fullcopy"&gt;  
                &lt;instrpath location="${build.classes.dir}"/&gt;  
                    &lt;filter includes=" \*.\*" /&gt;  
                 
            &lt;/instr&gt;  
        &lt;/emma&gt;  
    &lt;/target&gt;

   
     &lt;target name="test" depends="instr"&gt;  
        &lt;mkdir dir="${build.doc.junit.dir}" /&gt;  
        &lt;mkdir dir="${build.doc.coverage.dir}" /&gt;  
         
        &lt;junit printsummary="yes"  
               haltonfailure="no" fork="true"&gt;  
            &lt;classpath location="${build.coverage.dir}/classes"/&gt;  
            &lt;classpath location="${build.classes.dir}"/&gt;  
            &lt;classpath location="${build.test.dir}"/&gt;  
           
            &lt;classpath location="${EMMA\_HOME}/lib/emma.jar"/&gt;  
            &lt;classpath location="${EMMA\_HOME}/lib/emma\_ant.jar"/&gt;  
            &lt;jvmarg value="-Demma.coverage.out.file=${build.coverage.dir}/coverage.ec" /&gt;  
            &lt;jvmarg value="-Demma.coverage.out.merge=true" /&gt;  
            &lt;formatter type="xml" /&gt;  
            &lt;batchtest todir="${build.doc.junit.dir}"&gt;  
                &lt;fileset dir="${src.test.dir}"&gt;  
                    &lt;include name="\*\*/\*Test.java" /&gt;  
                 
                    
                &lt;/fileset&gt;  
            &lt;/batchtest&gt;  
        &lt;/junit&gt;