« Return to Thread: newbie question about specifying testClassesDirectory

newbie question about specifying testClassesDirectory

by thebad :: Rate this Message:

Reply to Author | View in Thread


Hi,

I am new to maven (about 2 hours in), and I am working through a
tutorial that I download here;
http://www.lulu.com/content/1080910
I can run the "Hello world" app under eclipse.

However I am having a problem that when I run ;

$ mvn -e clean package

I get an error;
org.apache.maven.surefire.booter.SurefireExecutionException: Unable to
create test class 'com.mytutorial.AppTest';

Now, the "com.mytutorial.AppTest" class has been created in the
"./target/test-classes/" folder, so I guess that either there is
something wrong with the test class, which seems to compile ok;
[INFO] Compiling 1 source file to
/home/tomh/eclipse/workspace/simple/target/test-classes

or that the surefire:test cannot find the test-classes folder with the
test class.

Any ideas?

Thanks,

Tom

Fedora11 x86_64
$ mvn -version
/usr/lib/jvm/java
Maven version: 2.0.4
$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.5) (fedora-22.b16.fc11-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b15, mixed mode)
eclipse-platform-3.4.2-9.fc11.x86_64




[tomhodder@localhost simple]$ mvn -e clean package
/usr/lib/jvm/java
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
----------------------------------------------------------------------------
[INFO] Building simple
[INFO]    task-segment: [clean, package]
[INFO]
----------------------------------------------------------------------------
[INFO] Ignoring available plugin update: 2.3 as it requires Maven
version 2.0.6
[INFO] [clean:clean]
[INFO] Deleting directory /home/tomh/eclipse/workspace/simple/target
[INFO] Ignoring available plugin update: 2.3 as it requires Maven
version 2.0.6
[INFO] Ignoring available plugin update: 2.4.3 as it requires Maven
version 2.0.6
[INFO] Ignoring available plugin update: 2.2 as it requires Maven
version 2.0.6
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to
/home/tomh/eclipse/workspace/simple/target/classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Compiling 1 source file to
/home/tomh/eclipse/workspace/simple/target/test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory:
/home/tomh/eclipse/workspace/simple/target/surefire-reports
org.apache.maven.surefire.booter.SurefireExecutionException: Unable to
create test class 'com.mytutorial.AppTest'; nested exception is
java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:/tmp/surefirebootern98x3v.jar],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}};
nested exception is
org.apache.maven.surefire.testset.TestSetFailedException: Unable to
create test class 'com.mytutorial.AppTest'; nested exception is
java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:/tmp/surefirebootern98x3v.jar],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
org.apache.maven.surefire.testset.TestSetFailedException: Unable to
create test class 'com.mytutorial.AppTest'; nested exception is
java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:/tmp/surefirebootern98x3v.jar],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:/tmp/surefirebootern98x3v.jar],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
    at java.net.URLClassLoader.findClass(libgcj.so.10)
    at java.lang.ClassLoader.loadClass(libgcj.so.10)
    at java.lang.ClassLoader.loadClass(libgcj.so.10)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:87)
    at
org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:156)
    at java.lang.reflect.Method.invoke(libgcj.so.10)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
    at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to
/home/tomh/eclipse/workspace/simple/target/surefire-reports for the
individual test results.
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: There are test failures.

Please refer to
/home/tomh/eclipse/workspace/simple/target/surefire-reports for the
individual test results.
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(maven-core-2.0.4.jar.so)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(maven-core-2.0.4.jar.so)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(maven-core-2.0.4.jar.so)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(maven-core-2.0.4.jar.so)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(maven-core-2.0.4.jar.so)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(maven-core-2.0.4.jar.so)
    at org.apache.maven.DefaultMaven.doExecute(maven-core-2.0.4.jar.so)
    at org.apache.maven.DefaultMaven.execute(maven-core-2.0.4.jar.so)
    at org.apache.maven.cli.MavenCli.main(maven-core-2.0.4.jar.so)
    at java.lang.reflect.Method.invoke(libgcj.so.10)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test
failures.

Please refer to
/home/tomh/eclipse/workspace/simple/target/surefire-reports for the
individual test results.
    at
org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:530)
    at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(maven-core-2.0.4.jar.so)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(maven-core-2.0.4.jar.so)
    ...13 more
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Thu Jul 02 17:15:26 BST 2009
[INFO] Final Memory: 26M/51M
[INFO]
------------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: newbie question about specifying testClassesDirectory