I've been encountering an issue with Maven Surefire Plugin. When running my tests, I'm getting an error indicating an initialization issue. The tests actually run successfully on my local, but when I am trying to run those on integration env getting this error.On local I tried with mvn clean install also using intellij runner configuration.
To provide some context, here's a snippet of the relevant configuration from my pom.xml file:
part of pom which is releted
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
</plugins>
</build>
<!-- JUnit 5 dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
Has anyone encountered a similar issue with Maven Surefire Plugin, especially in any environment? What steps did you take to resolve it? Any insights or suggestions would be greatly appreciated. Thank you for your help!
You have to upgrade maven-surefire-plugin to the most recent versions (https://maven.apache.org/plugins/) at minimum 2.22.2 but better use the most recent 3.2.5... also upgrade JUnit Jupiter to most recent versions (5.10.2) and better use bom import...
The version you are using of the maven-surefire-plugin (2.4.2) is of 2008 !!!!
That means your pom file should look like this:
That means you should check that all plugins used are used in most recent versions. The definition for the plugins should be done via
pluginManagement..The usage of
<maven.compiler.release>8</maven.compiler.release>is best way to define for JDK9+