的Cobertura ant脚本缺少Log4J的类 [英] Cobertura ant script is missing Log4J classes

查看:218
本文介绍了的Cobertura ant脚本缺少Log4J的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让的Cobertura 我的ant脚本中运行,但我在开始时卡住权利。当我尝试插入的Cobertura的的taskdef 的我错过了Log4J的库。

I tried to get Cobertura running inside my ant script, but I'm stuck right at the beginning. When I try to insert the cobertura taskdef I'm missing the Log4J libraries.

<property name="cobertura.dir" location="/full/path/to/cobertura-1.9.3" />
<path id="cobertura.classpath">
	<fileset dir="${cobertura.dir}">
		<include name="cobertura.jar" />
		<include name="lib/**/*.jar" />
	</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />

我的Ant目标

<!-- ================================= 
      target: cobertura              
     ================================= -->
<target name="cobertura" depends="clean, init" description="Generates cobertura coverage reports">
	<cobertura-instrument todir="${dir.build.instrumented}">
		<fileset dir="${dir.build}">
			<include name="**/*.class" />
		</fileset>
	</cobertura-instrument>
</target>

我觉得我做的一切就像是在的Cobertura文档描述,但我得到这个

BUILD FAILED
build.xml:95: java.lang.NoClassDefFoundError: org/apache/log4j/Logger

$ {cobertura.dir} 还有就是 的lib 与所有文件的目录。我从分布的Cobertura直接ZIP到该目录中解压缩它。

Inside the ${cobertura.dir} there is the lib directory with all files. I unzipped it from the cobertura distribution ZIP directly into that directory.

我缺少的一个步骤?有毛病我的配置如何呢?

Am I missing a step? Something wrong with my configuration so far?

推荐答案

我也遇到了这个问题今天并指定所有所需的库的位置提供给我的taskdef任务的类路径的一部分,解决了这个问题。

I also encountered this problem today and solved it by specifying the location of all the required libraries as part of the class path provided to my taskDef task.

<path id="cobertura.class.path">
    <pathelement location="${common.dir}/../tools/cobertura/cobertura.jar" />
    <pathelement location="${common.dir}/../tools/cobertura/lib/asm-3.0.jar" />
    <pathelement location="${common.dir}/../tools/cobertura/lib/asm-tree-3.0.jar" />
    <pathelement location="${common.dir}/../tools/cobertura/lib/log4j-1.2.9.jar" />
    <pathelement location="${common.dir}/../tools/cobertura/lib/jakarta-oro-2.0.8.jar" />
</path>

<taskdef classpathref="cobertura.class.path" resource="tasks.properties" />

这篇关于的Cobertura ant脚本缺少Log4J的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆