Maven surefire could not find ForkedBooter class

后端 未结 20 2540
盖世英雄少女心
盖世英雄少女心 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:23

    I have another workaround. Set the environment variable _JAVA_OPTIONS. I've used this for our TeamCity build agents and now our builds run fine.

    _JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true
    
    0 讨论(0)
  • 2020-11-28 19:28

    Set useSystemClassloader to false:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
            <useSystemClassLoader>false</useSystemClassLoader>
        </configuration>
    </plugin>
    

    If you're not inheriting from a parent which has version defined for you (such as the Spring Boot starter) you'll need to define that as well.

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

    I found this workaround and fixed my tests: configure the maven-surefire-plugin not to use the system classloader.

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

    Basically is an incompatibility between JDK version and maven-surefire plugin version, in my case, JDK 11.0.5 doesn't work with surefire 3.0.0-M4, I had to switch to 3.0.0-M3 and it worked. setting forkCount to 0 doesn't fix the issue because it breaks the Jacoco report.

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

    When using GitLab CI/CD with 3.6.0-jdk-8 image only the property below helped (without modifying pom.xml).

    -Dsurefire.useSystemClassLoader=false
    
    0 讨论(0)
  • 2020-11-28 19:30

    The suggestion above to set the property "-Djdk.net.URLClassPath.disableClassPathURLCheck=true" did NOT work for me, but setting the following does work OK:

    -DforkCount=0
    
    0 讨论(0)
提交回复
热议问题