java - Ant + JUnit: NoClassDefFoundError -


OK, I'm frustrated!

Environment: WinXP, Eclipse Galileo 3.5 (Direct Install - No Extra Plugins)

So, I have a great time and I'm still stumped.

A simple JUnit test is running fine with this internal Eclipse junket run configuration, this class has nothing dependency. To reduce this problem as low as possible, just include:

  @Test public zero testX () {assertEquals ("1", new integer (1) .stusting ()) ; }  

There is no sweat so far. Now I want to take the super-advanced step of running this test from within ET (the final goal is to integrate with Hudson).

Then, I will create a build.xml:

  & lt; Project name = "test" default = "original" & gt; & Lt; Property Name = "default.target.dir" value = "$ {baseir} / target" /> & Lt; Property name = "test.report.dir" value = "$ {default.target.dir} / test-report" /> & Lt; Goal name = "original" & gt; & Lt; Mkdir dir = "$ {test.report.dir}" /> & Lt; Junit fork = "true" printSummary = "true" showOutput = "true" & gt; & Lt; Formatter type = "plain" /> & Lt; Classpath & gt; & Lt; Pathelement path = "$ {baseir} / bin" /> & Lt; / Classpath & gt; & Lt; Batchtest fork = "true" todir = "$ {test.report.dir}" & gt; & Lt; Fileset dir = "$ {baseir} / bin" & gt; & Lt; Include name = "** / * test. *" / & Gt; & Lt; / Fileset & gt; & Lt; / Batchtest & gt; & Lt; / JUnit & gt; & Lt; / Target & gt; & Lt; / Project & gt;  

$ {basedir} is the name of the Java project in the workspace that contains the source, category and build file. all. Java and build.xml are in $ {baseir} / src .class files are in the $ {baseir} / bin.

I have added the ant runtime classpath through the eclipse install-directory / plugins / org.junit4_4.5.0.v20090423 / junit.jar / entries of priorities / ant / runtime / contributions Ant- Junit.jar ant is in home listings.

So, what happens when I run this highly complex goal? My report file includes:

  Testuite: run com.xyz.test.RussianTest test: 1, failures: 0, Errors: 1, Elapsed time: 0 seconds testcase: initializationError took 0 second because an error ORG / hamcrest / selfDescribing java.lang.NoClassDefFoundError: org / hamcrest / java.lang.ClassLoader.defineClass1 (native Method) at an undisclosed source java.lang.ClassLoader.defineClass (unknown source) java.security.SecureClassLoader on .defineClass (unknown source) java.net.URLClassLoader.defineClass (unknown source java.net.URLClassLoader.access $ 000 on java.net.URLClassLoader $ 1.run on java.security.AccessController.doPrivileged) (unknown source) (Eg After source) (unknown source) JavaknetkURLClassLoaderkfindClass (Unknown Source java.lang.ClassLoader.loadClass on sun.misc.Launcher $ AppClassLoader.loadClass (Unknown Source) at java.lang.ClassLoader.loadClass) ( unknown source) in the Basic Law) (due to JavaklangkreflectkConstructorknewInstance (unknown source) at JavaklangkClassLoaderkloadClassInternal (unknown source) at an undisclosed source): java.lang.ClassNotFoundException: java.security org.hamcrest.SelfDescribing on java.net.URLClassLoader $ 1.run (unknown source) at .AccessController.doPrivileged (Native method) sun.misc.Launcher $ AppClassLoader.loadClass (unknown source java.lang.ClassLoader.loadClass) Java.lang.ClassLoader.loadCl ass ((Unknown Source java.net.URLClassLoader.findClass (Unknown Source) at an undisclosed source)) java.lang.ClassLoader.loadClassInternal ( 
Unknown Source)

This org.hamcrest. What is the SelfDescribing Class? Have something to do with socks? it's a good thing. But why dependence? I am not doing anything with it. This is really a Java project with no dependencies other than the Java project.

Stumped (and frustrated) !!

I have downloaded Genesis 4.7 and in my build path (Junior Edition instead) Junit-4.7. If put it. He solved it, I did not touch the ant.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -