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

ClassNotFoundException with forkCount>1 and junit5

    XMLWordPrintableJSON

Details

    Description

      maven-version: 3.2.5 / 3.3.9
      OS: Windows 7
      Java 8 (compiler level & runtime)

      pom.xml (effective-pom)
            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.21.0</version>
              <executions>
                <execution>
                  <id>default-test</id>
                  <phase>test</phase>
                  <goals>
                    <goal>test</goal>
                  </goals>
                  <configuration>
                    <excludes>
                      <exclude>**/*IntegrationTest.java</exclude>
                    </excludes>
                    <testFailureIgnore>false</testFailureIgnore>
                    <forkCount>2</forkCount>
                    <reuseForks>true</reuseForks>
                    <forkedProcessTimeoutInSeconds>3600</forkedProcessTimeoutInSeconds>
                    <argLine>-Djava.util.logging.config.file=${project.base.dir}logging.properties</argLine>
                    <runOrder>alphabetical</runOrder>
                    <includes>
                      <include>**/*Test.java</include>
                    </includes>
                  </configuration>
                </execution>
              </executions>
              <dependencies>
                <dependency>
                  <groupId>org.junit.platform</groupId>
                  <artifactId>junit-platform-surefire-provider</artifactId>
                  <version>1.2.0</version>
                  <scope>compile</scope>
                </dependency>
                <dependency>
                  <groupId>org.junit.vintage</groupId>
                  <artifactId>junit-vintage-engine</artifactId>
                  <version>5.2.0</version>
                  <scope>compile</scope>
                </dependency>
                <dependency>
                  <groupId>org.junit.jupiter</groupId>
                  <artifactId>junit-jupiter-engine</artifactId>
                  <version>5.2.0</version>
                  <scope>compile</scope>
                </dependency>
              </dependencies>
              <configuration>
                <forkCount>2</forkCount>
                <reuseForks>true</reuseForks>
                <forkedProcessTimeoutInSeconds>3600</forkedProcessTimeoutInSeconds>
                <argLine>-Djava.util.logging.config.file=${project.base.dir}logging.properties</argLine>
                <runOrder>alphabetical</runOrder>
                <testFailureIgnore>false</testFailureIgnore>
                <includes>
                  <include>**/*Test.java</include>
                </includes>
                <excludes>
                  <exclude>**/*PerfTest.java</exclude>
                  <exclude>**/*IntegrationTest.java</exclude>
                </excludes>
              </configuration>
            </plugin>
      

      result is

      java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.log.api.ConsoleLogger
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project mts.ctsm: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test failed: java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.log.api.ConsoleLogger -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project mts.ctsm: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test failed: java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.log.api.ConsoleLogger
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test failed: java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.log.api.ConsoleLogger
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      	... 19 more
      Caused by: org.apache.maven.surefire.util.SurefireReflectionException: java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.log.api.ConsoleLogger
      	at org.apache.maven.plugin.surefire.CommonReflector.<init>(CommonReflector.java:56)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.getSuitesIterator(ForkStarter.java:693)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:317)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:292)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1149)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:978)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:854)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
      	... 20 more
      Caused by: java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.log.api.ConsoleLogger
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      	at org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:100)
      	at org.apache.maven.plugin.surefire.CommonReflector.<init>(CommonReflector.java:52)
      	... 28 more
      

      Attachments

        Activity

          People

            tibordigana Tibor Digana
            stefan.kuettner Stefan K├╝ttner
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: