You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (JIRA)" <ji...@apache.org> on 2019/01/23 22:42:00 UTC
[jira] [Comment Edited] (SUREFIRE-1520) ClassNotFoundException with
forkCount>1 and junit5
[ https://issues.apache.org/jira/browse/SUREFIRE-1520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16750491#comment-16750491 ]
Tibor Digana edited comment on SUREFIRE-1520 at 1/23/19 10:41 PM:
------------------------------------------------------------------
[~stefan.kuettner]
There is no bug.
Wrong use of Surefire by the user.
The problem was that you used {{junit-platform-surefire-provider}}. Do NOT do it!
Follow only our documentation and do not use the provider from JUnit5 group. Surefire activates internal provider automatically.
https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html
{noformat}
[INFO] Running Junit5Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s - in Junit5Test
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.436 s
[INFO] Finished at: 2019-01-23T23:32:37+01:00
[INFO] ------------------------------------------------------------------------
{noformat}
Simple POM (reuseForks=false):
{noformat}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mvnbug</groupId>
<artifactId>mvnbug</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
</project>
{noformat}
was (Author: tibor17):
[~stefan.kuettner]
There is no bug.
Wrong use of Surefire by the user.
The problem was that you used `junit-platform-surefire-provider`. Do NOT do it!
Follow only our documentation and do not use the provider from JUnit5 group. Surefire activates internal provider automatically.
https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html
{noformat}
[INFO] Running Junit5Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s - in Junit5Test
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.436 s
[INFO] Finished at: 2019-01-23T23:32:37+01:00
[INFO] ------------------------------------------------------------------------
{noformat}
Simple POM (reuseForks=false):
{noformat}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mvnbug</groupId>
<artifactId>mvnbug</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
</project>
{noformat}
> 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
> Assignee: Tibor Digana
> Priority: Major
> Labels: junit5
> Fix For: 3.0.0-M4
>
>
> 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)