I'm currently trying to deal with the following error caused by a junit task:
java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
My target is currently configured as this:
<target name="test" depends="include">
<mkdir dir="${reports}" />
<mkdir dir="${reports}/${build}" />
<!--<javac srcdir="src" includes="**/test/*.java" destdir="${reports}/${build}" />-->
<junit printsummary="on" haltonfailure="on" includeantruntime="on">
<classpath>
<pathelement location="${reports}/${build}" />
<pathelement location="/usr/share/java/hamcrest-core.jar" />
<!--<pathelement location="/usr/share/java/junit.jar" />-->
</classpath>
<formatter type="plain"/>
<batchtest todir="${reports}">
<formatter type="brief"/>
<fileset dir="src">
<include name="**/test/*.java" />
</fileset>
</batchtest>
</junit>
<delete dir="${reports}/${build}" quiet="true" />
</target>
I have already tried to use the system's junit jar, currently I'm including ant runtime which already includes a junit jar from somewhere, and I also tried having or not having that hamcrest path on the junit classpath.
I also tried compiling the tests before (the commented javac line). I am not a Java programmer, so to me this classpath stuff is a complete mess.
Grepping /usr/share/java/hamcrest-core.jar
shows there is something called SelfDescribing
inside it. There are also other files called hamcrest-library.jar
, hamcrest-generator.jar
and hamcrest-integration.jar
, but none of them neither any combination works.