Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-2285

ClassNotFoundException

    XMLWordPrintableJSON

Details

    Description

      Getting an error when running maven build.

      Using spring boot, Tried to override with different versions of Surefire plugin but did not help.

      Found a workaround by manually specifying  a missing dependency

      <dependency>
          <groupId>org.apache.maven.surefire</groupId>
          <artifactId>common-java5</artifactId>
          <version>${maven-surefire-plugin.version}</version>
          <scope>test</scope>
      </dependency> 
      # Created at 2024-11-07T19:56:29.078java.lang.NoClassDefFoundError: org/apache/maven/surefire/report/RunModeSetter	at java.base/java.lang.ClassLoader.defineClass1(Native Method)	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:113)	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
      Caused by: java.lang.ClassNotFoundException: org.apache.maven.surefire.report.RunModeSetter	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)	... 14 more
       

      Also found this thread where people are experiencing the same issue 

      https://stackoverflow.com/questions/78726126/noclassdeffounderror-exception-after-updating-to-the-latest-maven-surefire-plugi/79165732#79165732

      Attachments

        Activity

          People

            Unassigned Unassigned
            tsigelnik Dima
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: