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



<project xmlns="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";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>classloader.problem</groupId>
    <artifactId>problem</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Archetype - problem</name>
    <url>http://maven.apache.org</url>
    
    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testing-testng-version}</version>
            <scope>test</scope>
            <classifier>jdk15</classifier>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin-version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>three</id>
            <properties>
                <maven-surefire-plugin-version>2.3.1</maven-surefire-plugin-version>
                <testing-testng-version>5.1</testing-testng-version>
            </properties>
        </profile>
        <profile>
            <id>four</id>
            <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>
                        <configuration>
                            <childDelegation>true</childDelegation>
                            <forkMode>pertest</forkMode>
                            <argLine>-enableassertions</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to