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
It seems you have a random classloading issue.
The missing class appears since JUnit 4 : http://findjar.com/class/org/junit/runner/notification/RunListener.html
You should try to analyse surfire classpath by :
You will see something like :
surefireClassPathUrl.0=D\:\\maven2\\repository\\org\\apache\\maven\\surefire\\surefire-junit47\\2.17\\surefire-junit47-2.17.jar
surefireClassPathUrl.1=D\:\\maven2\\repository\\org\\apache\\maven\\surefire\\common-junit48\\2.17\\common-junit48-2.17.jar
surefireClassPathUrl.2=D\:\\maven2\\repository\\org\\apache\\maven\\surefire\\common-junit4\\2.17\\common-junit4-2.17.jar
surefireClassPathUrl.3=D\:\\maven2\\repository\\org\\apache\\maven\\surefire\\common-junit3\\2.17\\common-junit3-2.17.jar
surefireClassPathUrl.4=D\:\\maven2\\repository\\org\\apache\\maven\\surefire\\surefire-api\\2.17\\surefire-api-2.17.jar
surefireClassPathUrl.5=D\:\\maven2\\repository\\org\\apache\\maven\\surefire\\common-java5\\2.17\\common-java5-2.17.jar
surefireClassPathUrl.6=D\:\\maven2\\repository\\org\\apache\\maven\\shared\\maven-shared-utils\\0.4\\maven-shared-utils-0.4.jar
surefireClassPathUrl.7=D\:\\maven2\\repository\\com\\google\\code\\findbugs\\jsr305\\2.0.1\\jsr305-2.0.1.jar
surefireClassPathUrl.8=D\:\\maven2\\repository\\org\\apache\\maven\\surefire\\surefire-grouper\\2.17\\surefire-grouper-2.17.jar
Try to ensure JUnit 3.x -and related jars- are not loaded.
For example, you may try to exclude common-junit3 from surfire-junit47 :
org.apache.maven.surefire
surefire-junit47
2.17
org.apache.maven.surfire
common-junit3