我正在尝试使用 Cobertura 构建一个 jar 文件,运行该文件时出现此错误。
我下载了所有文件并将它们放在我的“/ lib”文件夹中;所以我那里有所有的 Cobertura 文件。
这是我的build.properties文件
# Project Variables
src.dir=src
classes.dir=bin
dist.lib=dist/lib
dist=dist
lib=lib
# Cobertura
cobertura.dir=lib
cobertura.ser=cobertura.ser
instrumented.dir=instrumented
reports.dir=reports
reports.xml.dir=${reports.dir}/junit-xml
reports.html.dir=${reports.dir}/junit-html
coverage.xml.dir=${reports.dir}/cobertura-xml
coverage.summaryxml.dir=${reports.dir}/cobertura-summary-xml
coverage.html.dir=${reports.dir}/cobertura-html
#Class main entries
class.main.main=server.controller.AccessControlMain
# Manifest properties
manifest.build.by=Alfredo Lopez
manifest.created.by=Team 4
manifest.main.class=${class.main.main}
这是我的 ant build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project default="pack-jar" name="main_ant">
<property file="build.properties" />
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="/*.jar" />
</fileset>
</path>
<path id="build.class.path">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<target name="cobertura-all">
<antcall target="cobertura-init"></antcall>
<antcall target="cobertura-compile-debug"></antcall>
<antcall target="cobertura-instrument"></antcall>
<antcall target="cobertura-pack-jar"></antcall>
</target>
<target name="cobertura-init">
<echo>Making directories...</echo>
<mkdir dir="${instrumented.dir}" />
<mkdir dir="${reports.xml.dir}" />
<mkdir dir="${reports.html.dir}" />
<mkdir dir="${coverage.xml.dir}" />
<mkdir dir="${coverage.summaryxml.dir}" />
<mkdir dir="${coverage.html.dir}" />
</target>
<target name="cobertura-compile-debug">
<echo>Compiling files with debug ...</echo>
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
debug="on"
classpathref="build.class.path"
includeantruntime="false"/>
</target>
<target name="cobertura-instrument">
<echo>Instrumenting files:</echo>
<delete file="cobertura.ser" />
<delete dir="${instrumented.dir}" />
<cobertura-instrument todir="${instrumented.dir}" datafile="${cobertura.ser}" >
<ignore regex="org.apache.log4j.*" />
<fileset dir="${classes.dir}">
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
<classpath>
<path refid="cobertura.classpath"></path>
</classpath>
</cobertura-instrument>
</target>
<target name="cobertura-pack-jar">
<echo>Packing cobertura</echo>
<!-- Covert build class path to a string -->
<pathconvert property="manifest.classpath" pathsep=" " >
<path refid="build.class.path" />
<flattenmapper />
</pathconvert>
<tstamp />
<jar basedir="${instrumented.dir}" destfile="${dist}/PantherLot_Main_Cobertura.jar">
<manifest>
<attribute name="Built-By" value="${manifest.build.by}"/>
<attribute name="Created-By" value="${manifest.created.by}"/>
<attribute name="Main-Class" value="${manifest.main.class}" />
<attribute name="Built-Date" value="${TODAY}"/>
<attribute name="Class-Path" value="${manifest.classpath}"/>
</manifest>
</jar>
</target>
<target name="cobertura-report">
<delete dir="${report.dir}" />
<cobertura-report format="html" destdir="${reports.dir}" srcdir="${src.dir}" />
</target>
</project>
任何类型的帮助将不胜感激。
谢谢