Re: newbie question about specifying testClassesDirectory
On 02/07/09 21:26, Anders Hammar wrote: The surefire plugin forks by default. Possibly there is a bug in the surefire plugin you're using (and you can't upgrade to the newest one as it requires a newer Maven version than you're using, hence my upgrade recommendation). I'm thinking that the class path isn't correctly passed when forking. You could try turn off the forking by the forkMode configuration: http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#forkMode Hi Anders, Adding the following to the pom.xml allows the tests to run through correctly. org.apache.maven.plugins maven-surefire-plugin never ... Thanks!!! Tom /Anders On Thu, Jul 2, 2009 at 22:07, Tom H wrote: Hi, Thanks for the reply, I've some comments in-lined below; On 02/07/09 20:09, Anders Hammar wrote: Hi, As a starter, you should probably upgrade Maven as version 2.0.4 is VERY old. You can tell from your attached output that there are newer surefire plugin versions that can't be used with Maven 2.0.4. I am pretty much stuck with what's in the fedora11 repos, so I am hoping to fix the problem or send in a bug report... Regarding your problem: Try running with "-X" (debug) instead of "-e" and then check the output. Look for the test classpath and verify that ./target/test-classes/ is included in the path. Just before the ClassNotFoundException it tries to run this; Forking command line: /bin/sh -c "cd /home/tomhodder/eclipse/workspace/simple&& /usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/bin/java -jar /tmp/surefirebooter4m1yoz.jar /tmp/surefire4m1yoxtmp /tmp/surefire4m1yoytmp" org.apache.maven.surefire.booter.SurefireExecutionException: Unable to create test class 'com.mytutorial.AppTest'; the surefire booter jar only contains this; [tomhod...@localhost simple]$ unzip -t /tmp/surefirebooter4m1yoz.jar Archive: /tmp/surefirebooter4m1yoz.jar testing: META-INF/MANIFEST.MF OK No errors detected in compressed data of /tmp/surefirebooter4m1yoz.jar. And the MANIFEST file contains the correct test-classes path If I strace that fork command it does what looks like find the correct AppTest class, and then gives up; stat("/home/tomhodder/eclipse/workspace/simple/target/test-classes/com/mytutorial/AppTest.class", {st_mode=S_IFREG|0664, st_size=1006, ...}) = 0 stat("/home/tomhodder/eclipse/workspace/simple/target/test-classes/com/mytutorial/AppTest.class", {st_mode=S_IFREG|0664, st_size=1006, ...}) = 0 ftruncate(9, 69632) = 0 mmap(NULL, 4096, PROT_READ|PROT_EXEC, MAP_SHARED, 9, 0x1) = 0x7ff109a66000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 9, 0x1) = 0x7ff109a65000 write(2, "org.apache.maven.surefire.booter."..., 500org.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/surefirebooter4m1yoz.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 i) = 500 write(2, "s java.lang.ClassNotFoundExceptio"..., 100s java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in gnu.gcj.runtime.SystemClassL) = 100 any ideas on that? Tom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: newbie question about specifying testClassesDirectory
Oh dear, maven seems to be using a different java to my eclipse installation; [t...@localhost simple]$ /usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/bin/java -version java version "1.5.0" gij (GNU libgcj) version 4.4.0 20090506 (Red Hat 4.4.0-4) Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [t...@localhost simple]$ 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) Tom On 02/07/09 21:07, Tom H wrote: Hi, Thanks for the reply, I've some comments in-lined below; On 02/07/09 20:09, Anders Hammar wrote: Hi, As a starter, you should probably upgrade Maven as version 2.0.4 is VERY old. You can tell from your attached output that there are newer surefire plugin versions that can't be used with Maven 2.0.4. I am pretty much stuck with what's in the fedora11 repos, so I am hoping to fix the problem or send in a bug report... Regarding your problem: Try running with "-X" (debug) instead of "-e" and then check the output. Look for the test classpath and verify that ./target/test-classes/ is included in the path. Just before the ClassNotFoundException it tries to run this; Forking command line: /bin/sh -c "cd /home/tomhodder/eclipse/workspace/simple && /usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/bin/java -jar /tmp/surefirebooter4m1yoz.jar /tmp/surefire4m1yoxtmp /tmp/surefire4m1yoytmp" org.apache.maven.surefire.booter.SurefireExecutionException: Unable to create test class 'com.mytutorial.AppTest'; the surefire booter jar only contains this; [tomhod...@localhost simple]$ unzip -t /tmp/surefirebooter4m1yoz.jar Archive: /tmp/surefirebooter4m1yoz.jar testing: META-INF/MANIFEST.MF OK No errors detected in compressed data of /tmp/surefirebooter4m1yoz.jar. And the MANIFEST file contains the correct test-classes path If I strace that fork command it does what looks like find the correct AppTest class, and then gives up; stat("/home/tomhodder/eclipse/workspace/simple/target/test-classes/com/mytutorial/AppTest.class", {st_mode=S_IFREG|0664, st_size=1006, ...}) = 0 stat("/home/tomhodder/eclipse/workspace/simple/target/test-classes/com/mytutorial/AppTest.class", {st_mode=S_IFREG|0664, st_size=1006, ...}) = 0 ftruncate(9, 69632) = 0 mmap(NULL, 4096, PROT_READ|PROT_EXEC, MAP_SHARED, 9, 0x1) = 0x7ff109a66000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 9, 0x1) = 0x7ff109a65000 write(2, "org.apache.maven.surefire.booter."..., 500org.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/surefirebooter4m1yoz.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 i) = 500 write(2, "s java.lang.ClassNotFoundExceptio"..., 100s java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in gnu.gcj.runtime.SystemClassL) = 100 any ideas on that? Tom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: newbie question about specifying testClassesDirectory
Hi, Thanks for the reply, I've some comments in-lined below; On 02/07/09 20:09, Anders Hammar wrote: Hi, As a starter, you should probably upgrade Maven as version 2.0.4 is VERY old. You can tell from your attached output that there are newer surefire plugin versions that can't be used with Maven 2.0.4. I am pretty much stuck with what's in the fedora11 repos, so I am hoping to fix the problem or send in a bug report... Regarding your problem: Try running with "-X" (debug) instead of "-e" and then check the output. Look for the test classpath and verify that ./target/test-classes/ is included in the path. Just before the ClassNotFoundException it tries to run this; Forking command line: /bin/sh -c "cd /home/tomhodder/eclipse/workspace/simple && /usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/bin/java -jar /tmp/surefirebooter4m1yoz.jar /tmp/surefire4m1yoxtmp /tmp/surefire4m1yoytmp" org.apache.maven.surefire.booter.SurefireExecutionException: Unable to create test class 'com.mytutorial.AppTest'; the surefire booter jar only contains this; [tomhod...@localhost simple]$ unzip -t /tmp/surefirebooter4m1yoz.jar Archive: /tmp/surefirebooter4m1yoz.jar testing: META-INF/MANIFEST.MF OK No errors detected in compressed data of /tmp/surefirebooter4m1yoz.jar. And the MANIFEST file contains the correct test-classes path If I strace that fork command it does what looks like find the correct AppTest class, and then gives up; stat("/home/tomhodder/eclipse/workspace/simple/target/test-classes/com/mytutorial/AppTest.class", {st_mode=S_IFREG|0664, st_size=1006, ...}) = 0 stat("/home/tomhodder/eclipse/workspace/simple/target/test-classes/com/mytutorial/AppTest.class", {st_mode=S_IFREG|0664, st_size=1006, ...}) = 0 ftruncate(9, 69632) = 0 mmap(NULL, 4096, PROT_READ|PROT_EXEC, MAP_SHARED, 9, 0x1) = 0x7ff109a66000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 9, 0x1) = 0x7ff109a65000 write(2, "org.apache.maven.surefire.booter."..., 500org.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/surefirebooter4m1yoz.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 i) = 500 write(2, "s java.lang.ClassNotFoundExceptio"..., 100s java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in gnu.gcj.runtime.SystemClassL) = 100 any ideas on that? Tom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
newbie question about specifying testClassesDirectory
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 [tomhod...@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.DefaultLifecycle