[report] nothing to do: no runtime coverage data found in any of the data files
Ant与Emma集成的时候总提示这种错误。。。查了下Emma QA说是runtime与 metadata
源代码如下,哪位遇到过这种问题。。
<?
xml version="1.0"
?>
< project name ="Toccata Code Quality" default ="init" basedir ="." >
< property name ="junitJar" value ="lib/UT/junit.jar" />
< property name ="emmaJar" value ="lib/UT/emma.jar" />
<!-- 目录配置 -->
< property name ="base.dir" location ="." />
< property name ="lib.dir" value ="./lib" />
< path id ="classpath.main" >
< pathelement location ="${build.src}" />
</ path >
< property name ="build.dest" value ="./src/classes" />
< property name ="build.test.bin" value ="./src/classes/test" />
< property name ="build.javadocs" value ="./src/UT/doc" />
< property name ="build.report" value ="./report" />
< property name ="build.src" value ="./src/UT/" />
< property name ="build.test" value ="/src/UT/test" />
< property name ="build.instrument" location ="./instrbin" />
< property name ="coverage.dir" location ="${base.dir}/report/UT/coverage" />
< property name ="emma.enabled" value ="true" />
<!-- 指示需要注入字节码的Java类的路径 -->
< path id ="classpath.main" >
< pathelement location ="${build.dest}" />
</ path >
< path id ="emma.lib" >
< pathelement location ="lib/UT/emma.jar" />
< pathelement location ="lib/UT/emma_ant.jar" />
</ path >
< taskdef resource ="emma_ant.properties" classpathref ="emma.lib" />
< target name ="init" >
< mkdir dir ="${build.instrument}" />
< mkdir dir ="report/UT/htmlreport" />
< mkdir dir ="${build.dest}" />
</ target >
< target name ="compile" depends ="init" >
< javac destdir ="${build.dest}" srcdir ="${build.src}/ibm" debug ="on" >
< classpath >
< pathelement location ="${junitJar}" />
< pathelement location ="${emmaJar}" />
</ classpath >
</ javac >
< copy todir ="${build.dest}" >
< fileset dir ="${build.src}/ibm" >
< include name ="**/*.class" />
< exclude name ="**/*.java" />
</ fileset >
</ copy >
</ target >
< target name ="compile-test" >
< mkdir dir ="${build.test.bin}" />
< javac destdir ="${build.test.bin}" debug ="on" >
< src path ="${build.test}" />
< classpath location ="${build.dest}" >
< pathelement location ="${junitJar}" />
</ classpath >
</ javac >
< copy todir ="${build.test.bin}" >
< fileset dir ="${build.test}" >
< include name ="**/*.class" />
< exclude name ="**/*.java" />
</ fileset >
</ copy >
</ target >
<!-- 对编译在路径build.src中的Java类注入字节码, 并且把注入字节码的新Java类存放到路径build.instrument -->
<!-- 覆盖率的元数据存放在路径coverage.dir中 -->
<!-- 插入字节码 -->
< target name ="instrument" depends ="compile" >
< emma enabled ="${emma.enabled}" >
< instr instrpathref ="classpath.main"
destdir ="${build.instrument}"
metadatafile ="${coverage.dir}/metadata.emma" merge ="true" >
</ instr >
</ emma >
< copy todir ="${build.instrument}" >
< fileset dir ="${build.dest}" >
< include name ="**/*.class" />
< exclude name ="**/*.java" />
</ fileset >
</ copy >
</ target >
< target name ="run" depends ="compile" >
< junit fork ="true" forkmode ="once" >
< jvmarg value ="-Demma.coverage.out.file = ${coverage.dir}/metadata.emma" />
< jvmarg value ="-Demma.coverage.out.merge = true" />
< classpath >
< pathelement location ="${build.src}/" />
< pathelement location ="${junitJar}" />
< pathelement location ="${emmaJar}" />
</ classpath >
< formatter type ="xml" />
<!-- formatter用于格式化测试输出结果 -->
< batchtest haltonfailure ="no" todir ="report" >
< fileset dir ="${build.test}" >
< include name ="**/*Test.java" />
</ fileset >
</ batchtest >
</ junit >
< junitreport todir ="${build.report}/UT/htmlreport" >
< fileset dir ="./report" id ="id" >
< include name ="*.xml" />
</ fileset >
< report todir ="${build.report}/UT/htmlreport" format ="frames" Styledir ="./report/XSL" >
</ report >
</ junitreport >
< echo message ="end running junit test" ></ echo >
</ target >
< target name ="coverage_report" depends ="instrument,compile" >
<!-- 如果属性emma.enabled的值是true,就生成代码覆盖率报告 -->
< emma enabled ="${emma.enabled}" >
< report sourcepath ="${build.src}/ibm"
sort ="+block,+name,+method,+class"
metrics ="method:70,block:80,line:80,class:100" >
< fileset dir ="${coverage.dir}" >
< include name ="*.emma" />
</ fileset >
< html outfile ="${coverage.dir}/coverage.html" />
</ report >
</ emma >
</ target >
<!-- checkstyle -->
< taskdef resource ="checkstyletask.properties" classpath ="lib/checkstyle/checkstyle-all-4.4.jar" />
< target name ="checkstyle_report" >
< checkstyle config ="conf/checkstyle/bpf_checks.xml" >
< fileset dir ="src" includes ="**/*.java" />
< formatter type ="plain" />
< formatter type ="xml" toFile ="report/checkstyle/checkstyle_errors.xml" />
</ checkstyle >
< xslt in ="report/checkstyle/checkstyle_errors.xml"
out ="report/checkstyle/checkstyle_report.html"
style ="conf/checkstyle/checkstyle-frames.xsl" />
</ target >
</ project >
< project name ="Toccata Code Quality" default ="init" basedir ="." >
< property name ="junitJar" value ="lib/UT/junit.jar" />
< property name ="emmaJar" value ="lib/UT/emma.jar" />
<!-- 目录配置 -->
< property name ="base.dir" location ="." />
< property name ="lib.dir" value ="./lib" />
< path id ="classpath.main" >
< pathelement location ="${build.src}" />
</ path >
< property name ="build.dest" value ="./src/classes" />
< property name ="build.test.bin" value ="./src/classes/test" />
< property name ="build.javadocs" value ="./src/UT/doc" />
< property name ="build.report" value ="./report" />
< property name ="build.src" value ="./src/UT/" />
< property name ="build.test" value ="/src/UT/test" />
< property name ="build.instrument" location ="./instrbin" />
< property name ="coverage.dir" location ="${base.dir}/report/UT/coverage" />
< property name ="emma.enabled" value ="true" />
<!-- 指示需要注入字节码的Java类的路径 -->
< path id ="classpath.main" >
< pathelement location ="${build.dest}" />
</ path >
< path id ="emma.lib" >
< pathelement location ="lib/UT/emma.jar" />
< pathelement location ="lib/UT/emma_ant.jar" />
</ path >
< taskdef resource ="emma_ant.properties" classpathref ="emma.lib" />
< target name ="init" >
< mkdir dir ="${build.instrument}" />
< mkdir dir ="report/UT/htmlreport" />
< mkdir dir ="${build.dest}" />
</ target >
< target name ="compile" depends ="init" >
< javac destdir ="${build.dest}" srcdir ="${build.src}/ibm" debug ="on" >
< classpath >
< pathelement location ="${junitJar}" />
< pathelement location ="${emmaJar}" />
</ classpath >
</ javac >
< copy todir ="${build.dest}" >
< fileset dir ="${build.src}/ibm" >
< include name ="**/*.class" />
< exclude name ="**/*.java" />
</ fileset >
</ copy >
</ target >
< target name ="compile-test" >
< mkdir dir ="${build.test.bin}" />
< javac destdir ="${build.test.bin}" debug ="on" >
< src path ="${build.test}" />
< classpath location ="${build.dest}" >
< pathelement location ="${junitJar}" />
</ classpath >
</ javac >
< copy todir ="${build.test.bin}" >
< fileset dir ="${build.test}" >
< include name ="**/*.class" />
< exclude name ="**/*.java" />
</ fileset >
</ copy >
</ target >
<!-- 对编译在路径build.src中的Java类注入字节码, 并且把注入字节码的新Java类存放到路径build.instrument -->
<!-- 覆盖率的元数据存放在路径coverage.dir中 -->
<!-- 插入字节码 -->
< target name ="instrument" depends ="compile" >
< emma enabled ="${emma.enabled}" >
< instr instrpathref ="classpath.main"
destdir ="${build.instrument}"
metadatafile ="${coverage.dir}/metadata.emma" merge ="true" >
</ instr >
</ emma >
< copy todir ="${build.instrument}" >
< fileset dir ="${build.dest}" >
< include name ="**/*.class" />
< exclude name ="**/*.java" />
</ fileset >
</ copy >
</ target >
< target name ="run" depends ="compile" >
< junit fork ="true" forkmode ="once" >
< jvmarg value ="-Demma.coverage.out.file = ${coverage.dir}/metadata.emma" />
< jvmarg value ="-Demma.coverage.out.merge = true" />
< classpath >
< pathelement location ="${build.src}/" />
< pathelement location ="${junitJar}" />
< pathelement location ="${emmaJar}" />
</ classpath >
< formatter type ="xml" />
<!-- formatter用于格式化测试输出结果 -->
< batchtest haltonfailure ="no" todir ="report" >
< fileset dir ="${build.test}" >
< include name ="**/*Test.java" />
</ fileset >
</ batchtest >
</ junit >
< junitreport todir ="${build.report}/UT/htmlreport" >
< fileset dir ="./report" id ="id" >
< include name ="*.xml" />
</ fileset >
< report todir ="${build.report}/UT/htmlreport" format ="frames" Styledir ="./report/XSL" >
</ report >
</ junitreport >
< echo message ="end running junit test" ></ echo >
</ target >
< target name ="coverage_report" depends ="instrument,compile" >
<!-- 如果属性emma.enabled的值是true,就生成代码覆盖率报告 -->
< emma enabled ="${emma.enabled}" >
< report sourcepath ="${build.src}/ibm"
sort ="+block,+name,+method,+class"
metrics ="method:70,block:80,line:80,class:100" >
< fileset dir ="${coverage.dir}" >
< include name ="*.emma" />
</ fileset >
< html outfile ="${coverage.dir}/coverage.html" />
</ report >
</ emma >
</ target >
<!-- checkstyle -->
< taskdef resource ="checkstyletask.properties" classpath ="lib/checkstyle/checkstyle-all-4.4.jar" />
< target name ="checkstyle_report" >
< checkstyle config ="conf/checkstyle/bpf_checks.xml" >
< fileset dir ="src" includes ="**/*.java" />
< formatter type ="plain" />
< formatter type ="xml" toFile ="report/checkstyle/checkstyle_errors.xml" />
</ checkstyle >
< xslt in ="report/checkstyle/checkstyle_errors.xml"
out ="report/checkstyle/checkstyle_report.html"
style ="conf/checkstyle/checkstyle-frames.xsl" />
</ target >
</ project >