Hi, there is something strange between your source files and your class files.
Is the pakcage of Tryit.java the default package or the "code" package ? First I would say have the same directory structure inside your src/main and src/test, and the same package for the class being tested and the test class. Second, if your Tryit.java uses the default package it should then be: - target/classes/Tryit.class - target/test-classes/TryitTest.class if it uses the "code" pakcage it should be: - target/classes/code/Tryit.class - target/test-classes/code/TryitTest.class I think the exception comes from those points... I would need a extract of your pom (project.xml) to be more precise. SaM On 5/3/05, Wim Vandewalle <[EMAIL PROTECTED]> wrote: > Hi > > I started recently setting up a test with Maven. > I followed the steps described in "Getting started - Creating a project". > I added 2 simple classes: > > - src/main/java/code/Tryit.java > - src/test/java/TryitTest.java (unit test) > > The java classes compile ok: > > - target/classes/main/java/code/TryIt.class > - target/test-classes/test/java/TryitTest.class > > However when running the unit tests it looks like the test class is not in > JUnit's classpath: > > C:\repositories\eclipse\maventest>maven test:test > __ __ > | \/ |__ _Apache__ ___ > | |\/| / _` \ V / -_) ' \ ~ intelligent projects ~ > |_| |_\__,_|\_/\___|_||_| v. 1.0.2 > > build:start: > > java:prepare-filesystem: > > java:compile: > [echo] Compiling to C:\repositories\eclipse\maventest/target/classes > [echo] > ========================================================== > > NOTE: Targetting JVM 1.4, classes > will not run on earlier JVMs > > ========================================================== > > [javac] Compiling 1 source file to > C:\repositories\eclipse\maventest\target\classes > > java:jar-resources: > > test:prepare-filesystem: > > test:test-resources: > > test:compile: > [javac] Compiling 1 source file to > C:\repositories\eclipse\maventest\target\test-classes > > test:test: > [junit] Running > [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec > [junit] Testsuite: TryItTest > [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec > [junit] > [junit] Null Test: Caused an ERROR > [junit] TryItTest > [junit] java.lang.ClassNotFoundException: TryItTest > [junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:199) > [junit] at java.security.AccessController.doPrivileged(Native Method) > [junit] at java.net.URLClassLoader.findClass(URLClassLoader.java:187) > [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:289) > [junit] at > sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) > [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:235) > [junit] at > java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) > [junit] at java.lang.Class.forName0(Native Method) > [junit] at java.lang.Class.forName(Class.java:141) > [junit] > [junit] > [junit] [ERROR] TEST TryItTest FAILED > > BUILD FAILED > File...... C:\Documents and > Settings\wvdw\.maven\cache\maven-test-plugin-1.6.2\plugin.jelly > Element... fail > Line...... 181 > Column.... 54 > There were test failures. > Total time: 3 seconds > Finished at: Tue May 03 11:44:52 CEST 2005 > > Any ideas? > > Wim > ----------------------------------------------------- > Mail.be, WebMail and Virtual Office > http://www.mail.be > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]