2013-04-08 93 views
0

我有我的蚂蚁脚本的问题。我必须在ant run上运行junit测试。神秘的蚂蚁脚本

我现在的剧本是这样的:

<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 the 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> 

在我的Linux机器上运行的测试很好,一切看起来不错。但是,在我的Windows,蚂蚁给我漂亮:

java.lang.NoClassDefFoundError: junit/framework/TestListener 

蚂蚁在调试模式但是告诉我,他装TestListener.class从suplied的JUnit 4.10.jar文件。

回答