These are the steps that create the error:
- Run my unit tests within Eclipse (Cntrl-F11). All 67 succeed and report as such.
- Using an Ant build.xml file, run a Cobertura task to generate a coverage report. The task fails stating that a unit test has failed.
- When I try to run the unit tests using Eclipse again, I receive the following error:
Unsupported major.minor version 51.0
(These symptoms persist until I use Project -> Clean within Eclipse.)
My Cobertura ant task is:
<target name="report-test" description="Generate a test coverage report." depends="clean, compile">
<taskdef resource="tasks.properties">
<classpath>
<pathelement location="${lib.dir}/cobertura-1.9.4.1/cobertura.jar" />
<pathelement location="${lib.dir}/cobertura-1.9.4.1/lib/asm-3.0.jar" />
<pathelement location="${lib.dir}/cobertura-1.9.4.1/lib/asm-tree-3.0.jar" />
<pathelement location="${lib.dir}/cobertura-1.9.4.1/lib/log4j-1.2.9.jar" />
<pathelement location="${lib.dir}/cobertura-1.9.4.1/lib/jakarta-oro-2.0.8.jar" />
</classpath>
</taskdef>
<cobertura-instrument todir="${build.dir}/cobertura-instrument">
<fileset dir="${build.dir}">
<include name="**/*.class"/>
</fileset>
</cobertura-instrument>
<junit printsummary="yes" fork="true" haltonfailure="yes" showoutput="yes">
<classpath location="${build.dir}/cobertura-instrument"/>
<classpath location="${build.dir}"/>
<classpath refid="classpath.test" />
<sysproperty key="net.sourceforge.cobertura.datafile" file="cobertura.ser"/>
<formatter type="xml" />
<batchtest todir="doc/junit">
<fileset dir="${test.dir}" />
</batchtest>
</junit>
<cobertura-report srcdir="${src.dir}" destdir="doc/coverage" format="xml" />
<delete file="cobertura.ser"/>
</target>