You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (Jira)" <ji...@apache.org> on 2021/01/27 22:28:00 UTC

[jira] [Commented] (SUREFIRE-1882) Fix failures when compiled on Java 9+ and run on Java 8

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

Tibor Digana commented on SUREFIRE-1882:
----------------------------------------

[~kriegaex]
Basically theory for me is to discuss java version, j7 or j8, due to currently it's j7 where we agreed in Maven project and it is worth to keep it for a while. We should keep it based on j7 because also the other plugins participated in the build lifecycle still support j7 too. I guess these requirements will change in some future version of Maven and then also the list of default plugins used by Maven Core would be updated and bump to j8 altogether with new Maven API version.
Maybe it would be worth to file a Jira issue to cover all those changes we would like to have with upcoming j8.
Personally, I guess j9 would be more challenging than j8 for Maven.

> Fix failures when compiled on Java 9+ and run on Java 8
> -------------------------------------------------------
>
>                 Key: SUREFIRE-1882
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1882
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Failsafe Plugin, Maven Surefire Plugin
>    Affects Versions: 3.0.0-M6
>            Reporter: Alexander Kriegisch
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: 3.0.0-M6
>
>         Attachments: 2021-01-26T13-22-12_972-jvmRun1.dump
>
>
> When running my build on JDK 8, I see
> {code}
> [INFO] --- maven-surefire-plugin:3.0.0-M6-SNAPSHOT:test (reuse-jvm) @ sarek-mock ---
> [INFO] 
> [INFO] -------------------------------------------------------
> [INFO]  T E S T S
> [INFO] -------------------------------------------------------
> [INFO] 
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> [WARNING] Could not delete temp directory C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157 because File C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157\surefirebooter4446112705128419789.jar unable to be deleted.
> [INFO] ------------------------------------------------------------------------
> [INFO] Reactor Summary for sarek-parent 1.0-SNAPSHOT:
> [INFO] 
> [INFO] (...)
> [INFO] sarek-mock ......................................... FAILURE [  1.541 s]
> [INFO] (...)
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time:  15.095 s
> [INFO] Finished at: 2021-01-26T13:22:20+07:00
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M6-SNAPSHOT:test (reuse-jvm) on project sarek-mock: There are test failures.
> [ERROR] 
> [ERROR] Please refer to C:\Users\alexa\Documents\java-src\Sarek\sarek-mock\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] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
> [ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_211\jre\bin\java" -jar C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157\surefirebooter4446112705128419789.jar C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157 2021-01-26T13-22-12_972-jvmRun1 surefire4902538894981773413tmp surefire_05054187083706494231tmp"
> [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
> [ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_211\jre\bin\java" -jar C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157\surefirebooter4446112705128419789.jar C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157 2021-01-26T13-22-12_972-jvmRun1 surefire4902538894981773413tmp surefire_05054187083706494231tmp"
> [ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:751)
> [ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:306)
> [ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:266)
> [ERROR] 	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1320)
> [ERROR] 	(...)
> {code}
> See also the dump file attached to this ticket.
> When running the build e.g. with Java 11 or Java 14, the same error does not occur. I tested with the current master, commit [f14fa54b|https://github.com/apache/maven-surefire/commit/f14fa54b9eba073c8c896a829fac1c2037b34222].
> The root cause seems to be this part of the dump file:
> {code}
> java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
> 	at org.apache.maven.surefire.api.util.internal.AbstractNoninterruptibleWritableChannel.write(AbstractNoninterruptibleWritableChannel.java:67)
> 	at org.apache.maven.surefire.api.util.internal.AbstractNoninterruptibleWritableChannel.write(AbstractNoninterruptibleWritableChannel.java:44)
> 	at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.write(AbstractStreamEncoder.java:77)
> 	at org.apache.maven.surefire.booter.spi.EventChannelEncoder.write(EventChannelEncoder.java:333)
> 	at org.apache.maven.surefire.booter.spi.EventChannelEncoder.encodeOpcode(EventChannelEncoder.java:324)
> 	at org.apache.maven.surefire.booter.spi.EventChannelEncoder.bye(EventChannelEncoder.java:274)
> 	at org.apache.maven.surefire.booter.ForkedBooter.acknowledgedExit(ForkedBooter.java:419)
> 	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:194)
> 	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:570)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:556)
> {code}
> {{ByteBuffer.flip()}} simply does not exist yet in Java 8. The [read-me file|https://github.com/apache/maven-surefire/blob/master/README.md] says:
> ??Build the Surefire project using Maven 3.1.0+ and JDK 1.8+.??
> OTOH, the corresponding [commit 5e3348cd|https://github.com/apache/maven-surefire/commit/5e3348cdf29d1d49ca615a893b9174563f62815c#diff-0dc38587795788db7bf5bc5366d065899b92d6680be60003ecd6af0fad3c8156] by [~tibordigana] is 2 years old already, calling a Java 9+ method {{flip()}}:



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