smart-testing
smart-testing copied to clipboard
Surefire cannot find Junit 5 provider while Smart Testing is enabled
Issue Overview
When using Smart Testing extension with Surefire and Junit 5, the Surefire plugin cannot find a provider implementation. However, when the -Dsmart.testing.disable=true
argument is passed into Maven, Surefire is able run to tests.
Expected Behaviour
Surefire should run Junit tests when Smart Testing is enabled.
Current Behaviour
When Smart Testing is enabled, Surefire fails to start and throws the exception below.
stack trace
java.lang.IllegalStateException: No surefire provider implementation has been detected as applicable for your environment. org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process java.lang.IllegalStateException: No surefire provider implementation has been detected as applicable for your environment. at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:656) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289) at org.apache.maven.cli.MavenCli.main(MavenCli.java:193) 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:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347) 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.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)
Steps To Reproduce
- Clone and checkout this branch https://github.com/ghunteranderson/smart-testing-example/tree/missing-surefire-provider
- Run
./mvnw test
to observe the issue - To compare, run tests with Smart Testing disabled:
./mvnw test -Dsmart.testing.disable=true
Additional Information
org.junit.jupiter:junit-jupiter:5.6.2 org.apache.maven.plugins:maven-surefire-plugin:2.22.2 org.arquillian.smart.testing:maven-lifecycle-extension:0.0.10
$mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: C:\Users\HunterAnderson\tools\apache-maven-3.6.3 Java version: 1.8.0_231, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_231\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"