Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-810

Endorsed dirs mechanism not working

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.11
    • 2.12
    • Maven Surefire Plugin
    • None

    Description

      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.

      Attachments

        1. pom.xml
          3 kB
          José Cervera
        2. TestSurefire.java
          0.6 kB
          José Cervera
        3. TEST-TestSurefire.xml
          8 kB
          José Cervera

        Activity

          People

            krosenvold Kristian Rosenvold
            jcervera José Cervera
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: