[Commented] (SUREFIRE-1568) Versions 2.21 and higher doesn't work with junit-platform for Java 9 module

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Commented] (SUREFIRE-1568) Versions 2.21 and higher doesn't work with junit-platform for Java 9 module

JIRA jira@apache.org

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

Pavel_K commented on SUREFIRE-1568:
-----------------------------------

{code:java}
$ mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T19:41:47+03:00)
Maven home: /usr/share/maven2
Java version: 9, vendor: Oracle Corporation
Java home: /opt/jdk-9
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-73-generic", arch: "amd64", family: "unix"
{code}
Place the project (I attached to the issue) in folder /home/Jim/Foo after that:
{code:java}
/Foo/mavenproject19$ mvn test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mavenproject19 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mavenproject19 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ mavenproject19 ---
[INFO] Required filename-based automodules detected. Please don't publish this project to a public artifact repository!
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/Jim/Foo/mavenproject19/target/classes
[WARNING] /home/Jim/Foo/mavenproject19/src/main/java/module-info.java:[13,8] module name component Mavenproject19 should avoid terminal digits
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mavenproject19 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/Jim/Foo/mavenproject19/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ mavenproject19 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/Jim/Foo/mavenproject19/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ mavenproject19 ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running me.pavel.mavenproject19.SimpleMathTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.03 s - in me.pavel.mavenproject19.SimpleMathTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.634 s
[INFO] Finished at: 2018-09-14T16:52:04+03:00
[INFO] Final Memory: 13M/45M
[INFO] ------------------------------------------------------------------------{code}
Now do the same but place project in `/home/Jim/Foo Boo`:
{code:java}
/Foo Boo/mavenproject19$ mvn test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mavenproject19 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mavenproject19 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ mavenproject19 ---
[INFO] Required filename-based automodules detected. Please don't publish this project to a public artifact repository!
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/Jim/Foo Boo/mavenproject19/target/classes
[WARNING] /home/Jim/Foo Boo/mavenproject19/src/main/java/module-info.java:[13,8] module name component Mavenproject19 should avoid terminal digits
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mavenproject19 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/Jim/Foo Boo/mavenproject19/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ mavenproject19 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/Jim/Foo Boo/mavenproject19/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ mavenproject19 ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.673 s
[INFO] Finished at: 2018-09-14T16:53:43+03:00
[INFO] Final Memory: 13M/45M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project mavenproject19: There are test failures.
[ERROR]
[ERROR] Please refer to /home/Jim/Foo Boo/mavenproject19/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd "/home/Jim/Foo Boo/mavenproject19" && /opt/jdk-9/bin/java '@/home/Jim/Foo Boo/mavenproject19/target/surefire/surefireargs4647087260922237551' '/home/Jim/Foo Boo/mavenproject19/target/surefire' 2018-09-14T16-53-43_054-jvmRun1 surefire4478496358020335503tmp surefire_012529440994284936256tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd "/home/Jim/Foo Boo/mavenproject19" && /opt/jdk-9/bin/java '@/home/Jim/Foo Boo/mavenproject19/target/surefire/surefireargs4647087260922237551' '/home/Jim/Foo Boo/mavenproject19/target/surefire' 2018-09-14T16-53-43_054-jvmRun1 surefire4478496358020335503tmp surefire_012529440994284936256tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1194)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1022)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:868)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[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:564)
[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] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException{code}

> Versions 2.21 and higher doesn't work with junit-platform for Java 9 module
> ---------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1568
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1568
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.21.0
>         Environment: Ubuntu
>            Reporter: Pavel_K
>            Priority: Major
>
> I have a simple JPMS module. When I use the maven-surefire-plugin 2.20.1 everything is ok - my tests are executed:
> {code:java}
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <version>2.20.1</version>
>                     <dependencies>
>                         <dependency>
>                             <groupId>org.junit.platform</groupId>
>                             <artifactId>junit-platform-surefire-provider</artifactId>
>                             <version>1.3.0</version>
>                         </dependency>
>                     </dependencies>
>             </plugin>{code}
> However, when I want to use newer versions of surefire (2.21.0 or 2.22.0) I get the following:
> {code:java}
>     Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
>     The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
>     Command was /bin/sh -c cd "/home/project" && /opt/jdk-9/bin/java '@/home/project/target/surefire/surefireargs4438382394951202560' '/home/project/target/surefire' 2018-09-13T13-42-05_435-jvmRun1 surefire4870497011802680670tmp surefire_015850140770716473411tmp
>     Error occurred in starting fork, check output in log
>     Process Exit Code: 1
>     org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
>     Command was /bin/sh -c cd "/home/project" && /opt/jdk-9/bin/java '@/home/project/target/surefire/surefireargs4438382394951202560' '/home/project/target/surefire' 2018-09-13T13-42-05_435-jvmRun1 surefire4870497011802680670tmp surefire_015850140770716473411tmp
>     Error occurred in starting fork, check output in log
>     Process Exit Code: 1
>     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671)
>     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
>     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)
>     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)
>     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1194)
>     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1022)
>     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:868)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
>     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:128)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
>     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.base/java.lang.reflect.Method.invoke(Method.java:564)
>     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)
>     -> [Help 1]{code}
> And in surefire-reports I see the following:
> {code:java}
>     # Created at 2018-09-13T13:42:07.587
>     Error: Could not find or load main class Projects..home.project.m2.repository.org.eclipse.persistence.javax.persistence.2.2.0.javax.persistence-2.2.0.jar:.home.project..m2.repository.org.eclipse.persistence.org.eclipse.persistence.core.2.7.0.org.eclipse.persistence.core-2.7.0.jar:.home.project..m2.repository.org.slf4j.slf4j-api.1.7.25.slf4j-api-1.7.25.jar ...
>     
>     # Created at 2018-09-13T13:42:07.588
>     Caused by: java.lang.ClassNotFoundException: /home/project//m2/repository/org/eclipse/persistence/javax/persistence/2/2/0/javax/persistence-2/2/0/jar:/home/project//m2/repository/org/eclipse/persistence/org/eclipse/persistence/core/2/7/0/org/eclipse/persistence/core-2/7/0/jar:/home/project//m2/repository/org/slf4j/slf4j-api/1/7/25/slf4j-api-1/7/25/jar ...{code}
> I tried to use only Junit jupiter as explained here [https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html] but result is the same. Maybe the problem is that surefire builds wrong path? See
> {code:java}
> :/home/project//m2/repository/org/slf4j/slf4j-api/1/7/25/slf4j-api-1/7/25/jar
> {code}
> As you see there are two slashes before m2. The question about this problem was asked also on SO [https://stackoverflow.com/questions/52312151/maven-surefire-plugin-with-junit-platform-surefire-provider-for-java-9-module]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)