Question

It doesn't work in ant, I'd like to run some classes that extend 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>

It says the following:

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[]
Was it helpful?

Solution

I think the problem is your taskdef, it's missing the path containing the dbunit jar:

<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="libs.dir"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top