Maven surefire could not find ForkedBooter class

后端 未结 20 2562
盖世英雄少女心
盖世英雄少女心 2020-11-28 19:21

Recently coming to a new project, I\'m trying to compile our source code. Everything worked fine yesterday, but today is another story.

Every time I\'m running

相关标签:
20条回答
  • 2020-11-28 19:39

    It's still an issue for surefire - v2.22.2 with maven:3.6-jdk-8-alpine. To fix the issue, add the below code to pom.xml (as maven plugin)

    ...
    <plugin>    
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId>  
        <configuration>
            <forkCount>0</forkCount>
        </configuration>
    </plugin>
    ...
    
    0 讨论(0)
  • 2020-11-28 19:41

    For those searching for an answer related to Docker Maven: 3.5.x-jdk-8 on GitLab CI, see this GitHub issue.

    It appears a 3.5.4-jdk-8 image resulted in upgrade to a minor Java version which somehow affects Surefire's forking mechanism.

    Rolling back to 3.5.3-jdk-8 image fixed this for me on my GitLab CI server building Java 1.8 code with Surefire 2.20.1.

    0 讨论(0)
  • 2020-11-28 19:43

    I had this issue in my GitLab CI build, which was using maven:3.5.4-jdk-8 Docker image.

    Changing it to maven:3.5.4-jdk-8-alpine fixed the problem.

    0 讨论(0)
  • 2020-11-28 19:43

    For Ubuntu: Install the latest version, it has this bug fixed

    sudo apt-get update ; sudo apt-get dist-upgrade -y
    

    Install the last working version (without security patches) without the bug.

    sudo apt-get install openjdk-8-jdk-headless=8u181-b13-1 openjdk-8-jdk=8u181-b13-1  openjdk-8-jre=8u181-b13-1  openjdk-8-jre-headless=8u181-b13-1 openjdk-8-source=8u181-b13-1
    

    If you missed that version, use the version before that:

    sudo apt-get install openjdk-8-jdk-headless=8u162-b12-1 openjdk-8-jdk=8u162-b12-1  openjdk-8-jre=8u162-b12-1  openjdk-8-jre-headless=8u162-b12-1 openjdk-8-source=8u162-b12-1
    

    Then use either pinning or watch out that you won't install the broken version.

    Using -Djdk.net.URLClassPath.disableClassPathURLCheck=true didn't work for me wherever I had put that configuration. Somewhere in my integration-tests it always exited without the old Java version.

    As mentioned by Erich it's a bug in the Debian package being too strict 911925 and the Surefire-plugin not acting according to the new rules SUREFIRE-1588.

    0 讨论(0)
  • 2020-11-28 19:43

    I recently setup maven job on Jenkins and got stuck into the same problem. I took the suggestion to modify the JAVA env variable and confirm the issue resolved. This is how I tested.

    Becomes "jenkins" user and change folder to workspace project name that you setup for the job.

     $ _JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true mvn clean install -U
    
     $ lsb_release -rd
     Description:   Ubuntu 16.04.5 LTS
     Release:   16.04
    
     $ mvn -v
     Apache Maven 3.3.9
     Maven home: /usr/share/maven
     Java version: 1.8.0_181, vendor: Oracle Corporation
     Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
     Default locale: en_US, platform encoding: UTF-8
     OS name: "linux", version: "4.4.0-131-generic", arch: "amd64", family: "unix"
    
    0 讨论(0)
  • 2020-11-28 19:45

    I posted a more targeted variant of one of the above workarounds in JIRA. Add to ~/.m2/settings.xml:

    <profile>
        <id>SUREFIRE-1588</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
        </properties>
    </profile>
    
    0 讨论(0)
提交回复
热议问题