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

John Patrick edited comment on SUREFIRE-1731 at 12/4/19 1:19 PM:
-----------------------------------------------------------------

For 1 project it doesn't need any custom '--add-opens' and for another I get;

{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}


was (Author: nhoj.patrick):
For 1 project it doesn't need any custom ```--add-opens``` and for another I 
get;

```
[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)
```

> Unable to test Multi Release Jar with surefire or failsafe
> ----------------------------------------------------------
>
>                 Key: SUREFIRE-1731
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1731
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Failsafe Plugin, Maven Surefire Plugin
>    Affects Versions: 2.22.2, 3.0.0-M4
>            Reporter: John Patrick
>            Priority: Major
>
> I'm creating a Multi Release jar, containing base Java 1.8 and Java 11 
> classes. But am not able to successful test the Java 11 part.
> In the following repo, I've got 3 tests.
>  * 1 test needs to be executed using Java 1.8 that are under src/test/java.
>  * 2 tests need to be executed using Java 11 that are under src/test/java11.
> If the src/test/java tests are executed using Java 11 I expect it to fail 
> which is expected, because it would be picking up the classes under 
> target/classes/META-INF/versions/11/ and not the Java 1.8 version under 
> target/classes/. Because the tests have been written to prove the correct 
> source file is used for execution so the Java 1.8 BaseClass returns a 
> different string to the Java 11 BaseClass.
> [https://github.com/nhojpatrick/issue-maven-multi-release-jar-testing]
>  



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

Reply via email to