environmentVariables fails with useSystemClassLoader=false or forkMode=always
-----------------------------------------------------------------------------

                 Key: SUREFIRE-763
                 URL: https://jira.codehaus.org/browse/SUREFIRE-763
             Project: Maven Surefire
          Issue Type: Bug
          Components: classloading, process forking
    Affects Versions: 2.9, 2.7.2, 2.7
         Environment: Apache Maven 3.0.3 (r1075438; 2011-02-28 19:31:09+0200)
Maven home: /stf/opt/apache-maven-3.0.3
Java version: 1.6.0_26, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre
Default locale: en_ZA, platform encoding: UTF-8
OS name: "linux", version: "2.6.38-11-generic", arch: "amd64", family: "unix"
            Reporter: Marius Kruger


I can't upgrade from surefire 2.6 because environmentVariables does not get 
properly populuated from 2.7 when using useSystemClassLoader=false or 
forkMode=always . 
In 2.6 my tests pass. From 2.7 if I only run the the test that requires the 
PATH to be set and have forkMode=once,
the test passes, but if run all the tests or set forkMode=always then it 
breaks. 

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <!--<version>2.6</version>-->
          <!--<version>2.7</version>-->
          <version>2.9</version>
          <configuration>
            <useSystemClassLoader>false</useSystemClassLoader>
            <!--
              <forkMode>never</forkMode>
            <forkMode>once</forkMode>
<forkMode>always</forkMode>
            -->
            <environmentVariables>
              <HOME>${env.HOME}</HOME>
              <PATH>${env.PATH}</PATH>
            </environmentVariables>
          </configuration>
        </plugin>


my tests work fine with 2.6: 
useSystemClassLoader=false and forkMode=once or forkMode=always
mvn test -Dtest=TestTaskUtils
[INFO] --- maven-surefire-plugin:2.6:test (default-test) 
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS


2.7:
useSystemClassLoader=false and forkMode=once
mvn test
Tests run: 92, Failures: 1, Errors: 1, Skipped: 0
[INFO] BUILD FAILURE
mvn test -Dtest=TestTaskUtils
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS

useSystemClassLoader=false and forkMode=always
mvn test -Dtest=TestTaskUtils
[INFO] BUILD FAILURE
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-surefire-plugin:2.7:test (default-test) on 
project ebr-orchestration-engine: There are test failures.
[ERROR] 
[ERROR] Please refer to 
/stf_fast/prj/e-breadboard/work/ebr-orchestration-engine/target/surefire-reports
 for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.apache.maven.plugins:maven-surefire-plugin:2.7:test (default-test) on 
project ebr-orchestration-engine: There are test failures.
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

(**/target/surefire-reports does not exist)


With 2.9 I get other strange behaviour:
useSystemClassLoader=false and forkMode=always
Forking command line: /bin/sh -c cd 
/stf_fast/prj/e-breadboard/work/ebr-orchestration-engine && 
/usr/lib/jvm/java-6-sun-1.6.0.26/jre/bin/java 
org.apache.maven.surefire.booter.ForkedBooter 
/stf_fast/prj/e-breadboard/work/ebr-orchestration-engine/target/surefire/surefire6100107079468387212tmp
 
/stf_fast/prj/e-breadboard/work/ebr-orchestration-engine/target/surefire/surefire6665672219640431542tmp
org.apache.maven.surefire.util.SurefireReflectionException: 
java.lang.ClassNotFoundException: za.co.enerweb.ebr.task.TestTaskUtils; nested 
exception is java.lang.ClassNotFoundException: 
za.co.enerweb.ebr.task.TestTaskUtils
java.lang.ClassNotFoundException: za.co.enerweb.ebr.task.TestTaskUtils
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at 
org.apache.maven.surefire.util.ReflectionUtils.loadClass(ReflectionUtils.java:203)
        at 
org.apache.maven.surefire.booter.PropertiesWrapper.getParamValue(PropertiesWrapper.java:132)
        at 
org.apache.maven.surefire.booter.PropertiesWrapper.getTypeDecoded(PropertiesWrapper.java:117)
        at 
org.apache.maven.surefire.booter.BooterDeserializer.deserialize(BooterDeserializer.java:63)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:63)
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD FAILURE
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on 
project ebr-orchestration-engine: No tests were executed!  (Set 
-DfailIfNoTests=false to ignore this error.) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on 
project ebr-orchestration-engine: No tests were executed!  (Set 
-DfailIfNoTests=false to ignore this error.)

Let me know if you need more info or need a sample app.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to