java - Mysterious Ant script -
i have problem ant script. have run junit test on ant run
.
my current script looks like:
<property name="src" location="src"/> <property name="build" location="build"/> <property name="doc" location="doc"/> <property name="dist" location="dest"/> <property name="lib" location="lib"/> <property name="app" value="${ant.project.name}.jar"/> <presetdef name="javac"> <javac includeantruntime="false"/> </presetdef> <target name="clean"> <delete dir="${build}"/> <delete dir="${dist}"/> </target> <target name="compile" depends="clean" description="compile"> <mkdir dir="${build}"/> <javac srcdir="${src}" destdir="${build}" classpath="${lib}/junit-4.10.jar:${lib}/swing-layout-1.0.4.jar:${src}"> </javac> <copy todir="${build}/checkers"> <fileset dir="${lib}"> <include name="resources/**" /> </fileset> </copy> </target> <target name="run" depends="compile"> <echo>running junit tests...</echo> <junit showoutput="no" fork="no"> <classpath> <pathelement location="${build}"/> <pathelement path="${build}:${lib}/junit-4.10.jar"/> </classpath> <formatter type="plain" usefile="false" /> <test name="checkers.checkerstest"/> </junit> </target>
on linux box test runs fine , looks good. on windows, ant gives nice:
java.lang.noclassdeffounderror: junit/framework/testlistener
ant in debug mode told me loaded testlistener.class suplied junit-4.10.jar file.
try answer http://youtrack.jetbrains.com/issue/tw-4882:
to fix problem should either use fork="true" attribute junit task (in case classpath created correctly), or copy junit.jar ant_home/lib (to ensure correct class loading).
here bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=36198. last comment says junit available in ant via org.eclipse.ant.optional.junit fragment
Comments
Post a Comment