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

Tibor Digana commented on SUREFIRE-1733:
----------------------------------------

[~rfscholte]
Why to distinguish for separate providers?
Because the users don't mind about our Surefire providers and junit5 engines.
And the user's are right in their view because they need to see their test code 
only and that's why they report these issues.

Look, there is very nice option where the user specifies only one dependency in 
the POM.
It is {{junit-jupiter-api}} and no engine. The plugin can activate the 
{{junit-jupiter-engine}} and the provider too of course. So the plugin can see 
the version of the API and add this engine to CP. Pretty nice and simple for 
the users because the users do not have to mind about our magic. They need to 
know that their tests will be executed and they know that the engine would be 
selected together with the provider.

Why this issue happened?
Because the old versions (5.3.x - 5.4.x) of JUnit5 did not contain 
{{module-info}} and we did not expect that these issues would happen and we 
simply placed them on CP instead of MP. Higher versions already have the 
{{module-info}}.

> Surefire and Failsafe JPMS additions for JUnit 5.x execution
> ------------------------------------------------------------
>
>                 Key: SUREFIRE-1733
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1733
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: Maven Failsafe Plugin, Maven Surefire Plugin
>    Affects Versions: 2.22.2, 3.0.0-M4
>            Reporter: John Patrick
>            Priority: Minor
>         Attachments: surefire-v2.22.2_junit-v5.5.2.txt, 
> surefire-v2.22.2_junit-v5.6.0-M1.txt, surefire-v3.0.0-M4_junit-v5.5.2.txt, 
> surefire-v3.0.0-M4_junit-v5.6.0-M1.txt
>
>
> Following on from SUREFIRE-1731 it was highlighted that some projects need 
> extra '--add-open' options for JUnit to execute correctly, lots have already 
> been handled or added or supported in previous releases but I'm needing to 
> add these for a project to run correctly.
> I'm happy to start looking at a patch, but need help with where repo or class 
> to start looking at.
> This is what extra arguments I'm needing to pass to surefire/failsafe.
> {code}
> --add-opens 
> ${project.Automatic-Module-Name}/${project.Automatic-Module-Name}=ALL-UNNAMED
> --add-opens 
> ${project.Automatic-Module-Name}/${project.Automatic-Module-Name}=org.junit.platform.commons
> --add-opens 
> org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED
> --add-opens 
> org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED
> {code}
> Luckly my module names and package names are all on the same standard and 
> I've got a maven property for each sub module defining what 
> 'project.Automatic-Module-Name' is.
> The 2nd two are probably easy and will work for everyone, the 1st two might 
> require some discussion and maybe define two variables that surefire and 
> failsafe can use, one for the module name and one for the package name if 
> they can dynamically scan the source code and work it out.
> This is the stacktrace I'm seeing;
> {code}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on 
> project PROJECT: There are test failures.
> [ERROR] 
> [ERROR] Please refer to PATH/target/surefire-reports for the individual test 
> results.
> [ERROR] Please refer to dump files (if any exist) [date].dump, 
> [date]-jvmRun[N].dump and [date].dumpstream.
> [ERROR] There was an error in the forked process
> [ERROR] java.lang.IllegalAccessError: class 
> org.junit.platform.launcher.core.LauncherFactory (in unnamed module 
> @0x6eceb130) cannot access class 
> org.junit.platform.commons.util.Preconditions (in module 
> org.junit.platform.commons) because module org.junit.platform.commons does 
> not export org.junit.platform.commons.util to unnamed module @0x6eceb130
> [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There 
> was an error in the forked process
> [ERROR] java.lang.IllegalAccessError: class 
> org.junit.platform.launcher.core.LauncherFactory (in unnamed module 
> @0x6eceb130) cannot access class 
> org.junit.platform.commons.util.Preconditions (in module 
> org.junit.platform.commons) because module org.junit.platform.commons does 
> not export org.junit.platform.commons.util to unnamed module @0x6eceb130
> [ERROR]       at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:656)
> [ERROR]       at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
> [ERROR]       at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
> [ERROR]       at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183)
> [ERROR]       at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
> [ERROR]       at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
> [ERROR]       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
> [ERROR]       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
> [ERROR]       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
> [ERROR]       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
> [ERROR]       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
> [ERROR]       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
> [ERROR]       at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
> [ERROR]       at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
> [ERROR]       at 
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
> [ERROR]       at 
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
> [ERROR]       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
> [ERROR]       at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
> [ERROR]       at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
> [ERROR]       at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
> [ERROR]       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [ERROR]       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [ERROR]       at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [ERROR]       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> [ERROR]       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> [ERROR]       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> [ERROR]       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> [ERROR]       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> [ERROR]       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [ERROR]       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [ERROR]       at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [ERROR]       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> [ERROR]       at 
> org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
> [ERROR]       at 
> org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
> [ERROR]       at 
> org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to