RE: Classpath Loader Differences between Surefire 2.3 and 2.4 causes tests to fail
The solution to the problem is to configure Surefire 2.4.2 to not use the System Classloader, i.e in the following way: false Or in more details: 2.4.2 5.7 org.apache.maven.plugins maven-surefire-plugin ${maven-surefire-plugin-version} false Dan Fabulich explained to me that this was the default behavior in Surefire 2.3 and that it was reversed in Surefire 2.4. -Original Message- From: Andreas Guther [mailto:[EMAIL PROTECTED] Sent: Monday, April 07, 2008 12:07 PM To: Maven Users List Subject: Classpath Loader Differences between Surefire 2.3 and 2.4 causes tests to fail Hi, We see a difference in classpath loading between Surefire 2.3 and 2.4. If we run the attached test against Surefire 2.3 and TestNG 5.1 we get the following output: mvn test -Pthree --- T E S T S --- Running ShowClassPathTest On my path:file:/C:/dev/svn.markettools.com/repos/dev/projects/problem/target/ test-classes/ On my path:file:/c:/m2/repo1/commons-collections/commons-collections/3.1/commo ns-collections-3.1.jar On my path:file:/C:/dev/svn.markettools.com/repos/dev/projects/problem/target/ classes/ On my path:file:/c:/m2/repo1/commons-io/commons-io/1.2/commons-io-1.2.jar On my path:file:/c:/m2/repo1/org/testng/testng/5.1/testng-5.1-jdk15.jar Number of elemenst on my path:5 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 If we run the same test with Surefire 2.4 and TestNG 5.7 we get a totally different classpath: mvn test -Pfour --- T E S T S --- Running TestSuite [Parser] Running: Command line suite On my path:file:/C:/Documents%20and%20Settings/aguther/Local%20Settings/Temp/s urefirebooter7279.jar On my path:file:/C:/usr/local/java/jdk1.5.0_10/jre/lib/ext/sunpkcs11.jar On my path:file:/C:/usr/local/java/jdk1.5.0_10/jre/lib/ext/dnsns.jar On my path:file:/C:/usr/local/java/jdk1.5.0_10/jre/lib/ext/sunjce_provider.jar On my path:file:/C:/usr/local/java/jdk1.5.0_10/jre/lib/ext/localedata.jar Number of elemenst on my path:5 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.235 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 Obviously in the second case none of the dependencies or compile directories are available. The different behavior gives us problems with the Web Framework we use (Stripes 1.4) and the associated tests which are not able to find any classes under Surefire 2.4. Stripes uses the following line to load the classes: ClassLoader loader = Thread.currentThread().getContextClassLoader(); Does anyone have an idea how to solve this issue and get the classes back on the path under Surefire 2.4? Thanks in advance for any help. Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classpath Loader Differences between Surefire 2.3 and 2.4 causes tests to fail
Andreas Guther wrote: Does anyone have an idea how to solve this issue and get the classes back on the path under Surefire 2.4? This is a somewhat frequently asked question, so I've written a wiki article about it: http://docs.codehaus.org/display/MAVENUSER/Classloading+and+Forking+under+Maven+Surefire Executive summary: useSystemClassLoader changed between Surefire 2.3 and Surefire 2.4. The default was useSystemClassLoader=false, but now the default is useSystemClassLoader=true. If you're having problems, try turning it back off to see if that helps. I've also written another article about classpath ordering (not relevant to you, but it has come up a few times): http://docs.codehaus.org/display/MAVENUSER/Classpath+Ordering+Bugs+in+Maven+Surefire -Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classpath Loader Differences between Surefire 2.3 and 2.4 causes tests to fail
On Monday 07 April 2008 Andreas Guther wrote: > We see a difference in classpath loading between Surefire 2.3 and 2.4. Search the archive of this list on nabble.com for "surefire 2.4 classpath" and you'll find your answer. Note, that there was a bug in maven 2.0.7, so updating to a newer maven version might be necessary. hth, - martin signature.asc Description: This is a digitally signed message part.
Classpath Loader Differences between Surefire 2.3 and 2.4 causes tests to fail
Hi, We see a difference in classpath loading between Surefire 2.3 and 2.4. If we run the attached test against Surefire 2.3 and TestNG 5.1 we get the following output: mvn test -Pthree --- T E S T S --- Running ShowClassPathTest On my path:file:/C:/dev/svn.markettools.com/repos/dev/projects/problem/target/ test-classes/ On my path:file:/c:/m2/repo1/commons-collections/commons-collections/3.1/commo ns-collections-3.1.jar On my path:file:/C:/dev/svn.markettools.com/repos/dev/projects/problem/target/ classes/ On my path:file:/c:/m2/repo1/commons-io/commons-io/1.2/commons-io-1.2.jar On my path:file:/c:/m2/repo1/org/testng/testng/5.1/testng-5.1-jdk15.jar Number of elemenst on my path:5 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 If we run the same test with Surefire 2.4 and TestNG 5.7 we get a totally different classpath: mvn test -Pfour --- T E S T S --- Running TestSuite [Parser] Running: Command line suite On my path:file:/C:/Documents%20and%20Settings/aguther/Local%20Settings/Temp/s urefirebooter7279.jar On my path:file:/C:/usr/local/java/jdk1.5.0_10/jre/lib/ext/sunpkcs11.jar On my path:file:/C:/usr/local/java/jdk1.5.0_10/jre/lib/ext/dnsns.jar On my path:file:/C:/usr/local/java/jdk1.5.0_10/jre/lib/ext/sunjce_provider.jar On my path:file:/C:/usr/local/java/jdk1.5.0_10/jre/lib/ext/localedata.jar Number of elemenst on my path:5 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.235 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 Obviously in the second case none of the dependencies or compile directories are available. The different behavior gives us problems with the Web Framework we use (Stripes 1.4) and the associated tests which are not able to find any classes under Surefire 2.4. Stripes uses the following line to load the classes: ClassLoader loader = Thread.currentThread().getContextClassLoader(); Does anyone have an idea how to solve this issue and get the classes back on the path under Surefire 2.4? Thanks in advance for any help. Andreas http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> 4.0.0 classloader.problem problem 1.0-SNAPSHOT Archetype - problem http://maven.apache.org org.testng testng ${testing-testng-version} test jdk15 commons-collections commons-collections 3.1 commons-io commons-io 1.2 org.apache.maven.plugins maven-surefire-plugin ${maven-surefire-plugin-version} three 2.3.1 5.1 four 2.4.2 5.7 org.apache.maven.plugins maven-surefire-plugin true pertest -enableassertions - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]