We are building a large multi module Maven project on Jenkins, including running a large number of unit test.
Once every few builds the build fails on NoClassDefF
Just try to use the surfire-junit4
in place of surfire-junit47
:
org.apache.maven.surefire
surefire-junit4
${testing.surefire.version}
It will change classpath/runtime behavior, as it comes with less dependencies :
You may also try to completely remove this dependency as it's not required for parallel support :
http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html
As of Surefire 2.7, no additional dependencies are needed to use the full set of options with parallel. As of Surefire 2.16, new thread-count attributes are introduced, namely threadCountSuites, threadCountClasses and threadCountMethods. Additionally, the new attributes parallelTestsTimeoutInSeconds and parallelTestsTimeoutForcedInSeconds are used to shut down the parallel execution after an elapsed timeout, and the attribute parallel specifies new values.
Does this solve the problem ?