Well, I think he should put the tests in src/test in a first place. This dependency is added automatically by the plugin.
-----Original Message----- From: Erik Husby [mailto:[EMAIL PROTECTED] Sent: Tue 3/2/2004 20:30 To: Maven Users List Cc: Subject: Re: Problems with Maven and JUnit: package junit.framework does not exist. Yes it is on the classpath. You need to declare a dependency on JUnit in your project.xml file. <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <url>http://junit.org</url> </dependency> </dependencies> Andy Hale wrote: > I recently installed maven-1.0-rc.tar.gz on Red Hat Enterprise Linux 3 > release: 4.3.0-55.EL. > I have junit.jar in my classpath and can compile JUnit Test classes > with java at the command line. I am attempting to compile a simple > JUnit class file, but when I attempt to compile the JUnit class with > maven it does not find the junit.jar. Can you please let me know what > I am doing wrong? > > -Andy Hale > > > *Here is my project.xml: > > *--------CUT--------- > <project> > <id>nesso</id> > <currentVersion>1.0</currentVersion> > <build> > <sourceDirectory> > ${basedir}/src/java > </sourceDirectory> > </build> > <unitTestSourceDirectory> > ${basedir}/src/test > </unitTestSourceDirectory> > </project> > --------CUT--------- > > *The output when attempting to run maven:* > > --------CUT--------- > $ maven java:jar > __ __ > | \/ |__ _Apache__ ___ > | |\/| / _` \ V / -_) ' \ ~ intelligent projects ~ > |_| |_\__,_|\_/\___|_||_| v. 1.0-rc1-SNAPSHOT > > java:prepare-filesystem: > > java:compile: > [echo] Compiling to /home/halea/sandbox/nesso/current/target/classes > [javac] Compiling 2 source files to > /home/halea/sandbox/nesso/current/target/classes > /home/halea/sandbox/nesso/current/src/java/nesso/metnet/navy/mil/BoxTest.java :3: > package junit.framework does not exist > import junit.framework.TestCase; > ^ > /home/halea/sandbox/nesso/current/src/java/nesso/metnet/navy/mil/BoxTest.java :5: > cannot resolve symbol > symbol : class TestCase > location: class nesso.metnet.navy.mil.BoxTest > public class BoxTest extends TestCase{ > ^ > /home/halea/sandbox/nesso/current/src/java/nesso/metnet/navy/mil/BoxTest.java :9: > cannot resolve symbol > symbol : method assertEquals (int,int) > location: class nesso.metnet.navy.mil.BoxTest > assertEquals(4,b.getArea()); > ^ > 3 errors > > BUILD FAILED > File...... file:/home/halea/.maven/plugins/maven-java-plugin-1.3/ > Element... ant:javac > Line...... 34 > Column.... 48 > Compile failed; see the compiler error output for details. > Total time: 8 seconds > Finished at: Tue Mar 02 10:40:05 PST 2004 > --------CUT--------- > **** > -- Erik Husby Team Lead for Software Quality Automation Genome Center at MIT Rm. 2192 320 Charles St Cambridge, MA 02141-2023 mobile: 781.354.6669 office: 617.258.9227 [EMAIL PROTECTED] --------------------------------------------------------------------- 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]
