ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Yang" <ya...@rewardstream.com>
Subject RE: Junit test problem
Date Fri, 06 Jun 2003 18:48:00 GMT
Thanks all for the responses!

After I did what you told me here, another type of error shows up as below
(I searched the mail archive again...)

I did put junit.jar in ANT_HOME/lib, any idea?



Thanks


Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
 - You have misspelt 'junit'.
   Fix: check your spelling.
 - The task needs an external JAR file to execute
   and this is not found at the right place in the classpath.
   Fix: check the documentation for dependencies.
   Fix: declare the task.
 - The task is an Ant optional task and optional.jar is absent
   Fix: look for optional.jar in ANT_HOME/lib, download if needed
 - The task was not built into optional.jar as dependent
   libraries were not found at build time.
   Fix: look in the JAR to verify, then rebuild with the needed
   libraries, or download a release version from apache.org
 - The build file was written for a later version of Ant
   Fix: upgrade to at least the latest release version of Ant
 - The task is not an Ant core or optional task
   and needs to be declared using <taskdef>.

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.

-----Original Message-----
From: Erik Husby [mailto:mhusby@genome.wi.mit.edu]
Sent: Friday, June 06, 2003 11:29 AM
To: Ant Users List
Subject: Re: Junit test problem


You have a classpath problem.

Your class is in a package called "teluswonderland" therefore your
classpath should reference a directory that contains the directory
"teluswonderland". One does not put class files in a classpath. One puts
directories that contain classes and one puts jar/zip files.

Your path should be written to be

<path id="test.path">
  <pathelement location="${basedir}/test"/>
</path>


Joseph Yang wrote:

>Hello all,
>
>I am very new to ant, I need some help please (I have searched the mail
>archive...), I am trying to run junit test using ant, in build.xml
>
> <path id="test.path">
>        <fileset dir="${basedir}/test">
>            <include name="*.class"/>
>        </fileset>
> </path>
>
>    <target name="runtests" depends="compiletests">
>    	<junit fork="yes" haltonerror="no" haltonfailure="no"
>printsummary="yes" >
>    	    <classpath refid="test.path"/>
>	    <test fork="true" name="teluswonderland.AllTests" haltonfailure="yes"
>outfile="result">
>	        <formatter type="xml"/>
>	    </test>
>    	</junit>
>    </target>
>
>When I run the test, it keeps giving me error as below, how to solve this?
>
>  <error message="teluswonderland.AllTests"
>type="java.lang.ClassNotFoundException">java.lang.ClassNotFoundException:
>teluswonderland.AllTests
>	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>	at java.security.AccessController.doPrivileged(Native Method)
>	at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
>	at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
>	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
>	at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
>	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
>	at java.lang.Class.forName0(Native Method)
>	at java.lang.Class.forName(Class.java:115)
></error>
>
>Thanks
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>

--
Erik Husby
Team Lead for Software Quality Automation
Whitehead Institute/MIT Center for Genome Research
Rm 2192
320 Charles St
Cambridge, MA 02141-2023
mobile: 781.354.6669
office: 617.258.9227
mhusby@genome.wi.mit.edu




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message