[nflug] [OT] JUnit and Ant

Michael Phillips linux478 at yahoo.com
Sat Aug 26 10:04:20 EDT 2006


Can someone point me in the right direction in setting up Ant 1.6.5 and JUnit
1.4 enviroment in Windows or Linux?  I am getting the following error.

C:\WINDOWS\system32\cmd.exe /c ant test
Buildfile: build.xml

compile:

compiletest:

test:
     [java] java.lang.NoClassDefFoundError: junit/swingui/TestRunner
     [java] Exception in thread "main"
     [java] Java Result: 1

Here is my build.xml file. 

<?xml version="1.0" ?>
<project default="run">
  
  <property file="build.properties" />
  <property name="bin.dir" location="bin" />
  <property name="build.dir" location="build" />
  <property name="classes.dir" location="${build.dir}/classes" />
  <property name="src.dir" location="src" />
  <property name="test.class" value="AllTest" />
  <property name="test.dir" location="test" />
  <property name="junit.filename" value="C:/Document and
Settings/Michael/Desktop/junit3.8.1/junit.jar" />

  <target name="compile">
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${src.dir}"
           destdir="${classes.dir}"
           />
  </target>
  <target name="compiletest">
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${test.dir}"
           classpath="${junit.filename}"
           destdir="${classes.dir}"
           />
  </target>
  <target name="test" depends="compile, compiletest">
      <!-- classname="junit.swingui.TestRunner" -->
      <!-- classname="junit.textui.TestRunner" -->
    <java
      classpath="${junit.filename}:${classes.dir}"
      classname="junit.swingui.TestRunner"
      fork="true"
    >
      <arg value="${test.class}"/>
    </java>
  </target>
  <target name="jar" depends="compile">
    <mkdir dir="${bin.dir}" />
    <jar destfile="${bin.dir}/${project.name}.jar"
         basedir="${classes.dir}"
    >
      <manifest>
        <attribute name="Main-Class" value="${main.class}"/>
      </manifest>
    </jar>
  </target>
  <target name="run" depends="jar">
    <java jar="${bin.dir}/${project.name}.jar" fork="true"/>
  </target>
  <target name="clean" depends="clean-build">
    <delete dir="${bin.dir}" />
  </target>
  <target name="clean-build">
    <delete dir="${build.dir}" />
  </target>
</project>

Thanks for the help

Michael D. Phillips - A computer science enthusiast
I do not hate Windows, I just like the alternatives better.
Linux is my primary choice.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug



More information about the nflug mailing list