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

Robert Scholte commented on SUREFIRE-1733:
------------------------------------------

No, that's not correct. Even though I'm not sure what you mean with "capable" ( 
I assume "it has a module descriptor"), there's no need to do that.
A quick lesson of JPMS: you specify the module with the main-class, plus 
optional additional modules. The JDK/JRE will verify if all required modules 
(both direct and indirect, or transitive as we would call it) are available. 
These are the only useful jars on the modulepath.
With plexus-java you give all artifacts and by specify the main artifact and 
based on that it can build up the modulepath and classspath.
Based on 
https://github.com/junit-team/junit5/blob/master/junit-platform-launcher/src/module/org.junit.platform.launcher/module-info.java
 I don't think this is a provider for some service. But if it is, you can 
simply set 
github.com/codehaus-plexus/plexus-languages/blob/master/plexus-java/src/main/java/org/codehaus/plexus/languages/java/jpms/ResolvePathsRequest.java#L225
 to true.
In general: plexus-java should give you the right module-path, there is no 
reason to iterate over the classpath again and shift artifacts. It simply means 
plexus-java was fed with incomplete information.


> 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