José Cervera created SUREFIRE-810:
-------------------------------------

             Summary: Endorsed dirs mechanism not working
                 Key: SUREFIRE-810
                 URL: https://jira.codehaus.org/browse/SUREFIRE-810
             Project: Maven Surefire
          Issue Type: Bug
          Components: Maven Surefire Plugin
    Affects Versions: 2.11
            Reporter: José Cervera
         Attachments: pom.xml, TestSurefire.java, TEST-TestSurefire.xml

The endorsed mechanism doesn't seem to work. 

You can reproduce this test by creating a new maven project, placing the java 
file in test/java, and using the provided pom.xml

The test class checks the jar from which the WebFault class is loaded. It's 
expected to use the one in the webservices library, as can be checked by 
executing the test from command line with the required parameters. 

When executing mvn test, the test fails:

C:\Users\Jose\xxxx\SurefireBug>mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - SurefireBug:SurefireBug:jar:0.0.1-SNAPSHOT
[INFO]    task-segment: [test]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered 
resources,i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [dependency:copy {execution: process}]
[INFO] Configured Artifact: org.glassfish.metro:webservices-rt:2.2-b10:jar
[INFO] Configured Artifact: org.glassfish.metro:webservices-api:2.2-b10:jar
[INFO] org.glassfish.metro:webservices-rt:2.2-b10:jar already exists in 
C:\Users\Jose\xxxx\SurefireBug\target\endorsed
[INFO] org.glassfish.metro:webservices-api:2.2-b10:jar already exists in 
C:\Users\Jose\xxxx\SurefireBug\target\endorsed
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [dependency:copy-dependencies {execution: install}]
[INFO] junit-4.10.jar already exists in destination.
[INFO] javax.annotation-3.1.1-b06.jar already exists in destination.
[INFO] webservices-api-2.2-b10.jar already exists in destination.
[INFO] webservices-rt-2.2-b10.jar already exists in destination.
[INFO] hamcrest-core-1.1.jar already exists in destination.
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: 
C:\Users\Jose\xxxx\SurefireBug\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSurefire
WebFault class:/C:/Program%20Files/Java/jdk1.6.0_25/jre/lib/rt.jar
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.036 sec <<< 
FAILURE!

Results :

Failed tests:   test(TestSurefire)

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to C:\Users\Jose\xxxx\SurefireBug\target\surefire-reports for the 
individual test results.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Dec 14 13:18:49 CET 2011
[INFO] Final Memory: 25M/346M
[INFO] ------------------------------------------------------------------------

And from command line:


C:\Users\Jose\xxxx\SurefireBug>java -Djava.endorsed.dirs=target\endorsed 
-classpath 
target\test-classes;target\lib\hamcrest-core-1.1.jar;target\lib\junit-4.10.jar;target\lib\webservices-api-2.2-b10.jar;target\lib\webservices-rt-2.2-b10.jar
 org.junit.runner.JUnitCore TestSurefire
JUnit version 4.10
.WebFault 
class:/C:/Users/Jose/agentmanagement/SurefireBug/target/endorsed/webservices-api-2.2-b10.jar

Time: 0,005

OK (1 test)

I've tried changing the forkMode, useSystemClassLoader and childDelegation 
parameters.
In the Test report we can see that the java.endorsed.dirs property is not 
changed.

I've also tried using a previous version (2.5). In this case, the property is 
changed, but the test also fails.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to