如何在ant中运行dbunit任务



它在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:kariakinjdbc_taskbuild.xml
BUILD FAILED
D:kariakinjdbc_taskbuild.xml:15: taskdef class org.dbunit.ant.DbUnitTask cannot be found
 using the classloader AntClassLoader[]

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

<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="libs.dir"/>

相关内容

  • 没有找到相关文章

最新更新