我想为我的应用程序提供代码覆盖率。这是我的build.xml文件。
<property name="src.dir" value="src"/>
<property name="coverage.dir" value="coverage"></property>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="FS" value="${file.separator}" />
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="com.test.main.Control"/>
<property name="emma.enabled" value="true" />
<path id="emma.lib" >
<pathelement location="${lib.dir}/emma.jar" />
<pathelement location="${lib.dir}/emma_ant.jar" />
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<!--fileset dir="${lib.dir}" includes="**/log4j.properties"/-->
</path>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false" classpathref="classpath" debug="on"/>
<!--copy todir="${{classes.dir}" file="${src.dir}${FS}hibernate.cfg.xml" /-->
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="emma" description="turns on EMMA's on-the-fly instrumentation mode" >
<property name="emma.enabled" value="true" />
<!-- EMMA instr class output directory: -->
<property name="out.instr.dir" value="outinstr" />
<mkdir dir="${out.instr.dir}" />
</target>
<emma enabled="${emma.enabled}" >
<report sourcepath="${src.dir}" >
<fileset dir="${coverage.dir}" >
<include name="*.emma" />
</fileset>
<txt outfile="${coverage.dir}/coverage.txt" />
<html outfile="${coverage.dir}/coverage.html" />
</report>
</emma>
</target>
<!--target name="clean-build" depends="clean,jar"/-->
<target name="main" depends="clean,run"/>
当我运行“ant emma run”命令时,获取异常
[java]错误:无法找到或加载主类com.test.main.Control [java] Java结果:1
请告诉我如何解决此问题。