0

它在 ant 中不起作用,我想运行一些扩展 DatabaseTestCase 的类

<path id="libs.dir">
                <fileset dir="lib" includes="**/*.jar" />
</path>
<taskdef name="dbunit" 
         classname="org.dbunit.ant.DbUnitTask"/>


<!-- run all tests in the source tree -->
<junit printsummary="yes" haltonfailure="yes">
  <formatter type="xml"/>
  <batchtest fork="yes" todir="${reports.tests}">
    <fileset dir="${src.tests}">
      <include name="**/*Test*.java"/>
    </fileset>
  </batchtest>
</junit>

它说:

Buildfile: D:\kariakin\jdbc_task\build.xml

BUILD FAILED
D:\kariakin\jdbc_task\build.xml:15: taskdef class org.dbunit.ant.DbUnitTask cannot be found
 using the classloader AntClassLoader[]
4

1 回答 1

1

我认为问题在于您的 taskdef,它缺少包含 dbunit jar 的路径:

<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="libs.dir"/>
于 2013-02-12T22:32:10.170 回答