maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Teglhus Møller (JIRA) <j...@apache.org>
Subject [jira] [Commented] (SUREFIRE-1520) ClassNotFoundException with forkCount>1 and junit5
Date Tue, 15 May 2018 13:31:00 GMT

    [ https://issues.apache.org/jira/browse/SUREFIRE-1520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16475834#comment-16475834
] 

Jens Teglhus Møller commented on SUREFIRE-1520:
-----------------------------------------------

I see the same error when using 
{code:xml}
  <reuseForks>false</reuseForks>
{code}
I was able to work around it by adding a regular project dependency:
{code:xml}
    <!-- apparently needed by junit5/surefire with reuseForks=false -->
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-logger-api</artifactId>
      <version>${surefire.version}</version>
      <scope>test</scope>
    </dependency>
{code}

> ClassNotFoundException with forkCount>1 and junit5
> --------------------------------------------------
>
>                 Key: SUREFIRE-1520
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1520
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 5.x support, Maven Surefire Plugin
>    Affects Versions: 2.21.0
>            Reporter: Stefan Küttner
>            Priority: Major
>
> maven-version: 3.2.5 / 3.3.9
> OS: Windows 7
> Java 8 (compiler level & runtime)
> {code:xml|title=pom.xml (effective-pom)|collapse=true}
>       <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>
> {code}
> result is 
> {code:java|title=java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.log.api.ConsoleLogger|collapse=true}
> [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
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message