The solution to the problem is to configure Surefire 2.4.2 to not use the System Classloader, i.e in the following way:
<configuration><useSystemClassLoader>false</useSystemClassLoader></confi guration> Or in more details: <properties> <maven-surefire-plugin-version>2.4.2</maven-surefire-plugin-version> <testing-testng-version>5.7</testing-testng-version> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven-surefire-plugin-version}</version> <configuration> <useSystemClassLoader>false</useSystemClassLoader> </configuration> </plugin> </plugins> </build> 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]