TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.47k stars 2.57k forks source link

mvn error : release version 7 not supported #1416

Closed nd185084 closed 1 month ago

nd185084 commented 3 months ago

I get this error when i run the compile with visual studio code:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project Java-WebSocket: Fatal error compiling: error: release version 7 not supported -> [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 PS C:\Temp\Java-WebSocket-master\Java-WebSocket-master>

Any help is appreciated.

PhilipRoman commented 3 months ago

In general when reporting issues please provide at least the following info:

Anyway, pom.xml currently specifies version 7 to be compatible with very old JVMs, but recent version of java have started to drop support for cross compilation to old releases, in particular Java 20 removed support for 7: https://bugs.openjdk.org/browse/JDK-8173605

For a quick fix you can just replace <release>7</release> in pom.xml with <release>8</release> (or any other newer version)

@marci4 Any thoughts how this can be resolved long-term (since JDK will keep deprecating target versions) for users who want to build from source? Maybe update normal pom.xml to use newer target and use 7 only for Maven Central releases via config option. I don't know anything about maven, but looks like maven supports this syntax: <release>${jws_release}</release> which can be configured using -Djws_release=7 (and the default can be set inside <build><properties>...)

marci4 commented 3 months ago

Hey @PhilipRoman, Sorry the mention got lost in my vacation mails.

To be honest, I have no good idea solving this java 7 problem. I was surprised how many problems had problems using a java 1.7 api (introduced with API level 24). Google Play Servers just dropped the support for API Level 20 (https://android-developers.googleblog.com/2023/07/google-play-services-discontinuing-updates-for-kitkat.html). There is however some magic happening for some java 8 apis (https://developer.android.com/studio/write/java8-support#library-desugaring).

The main problem for me is that I don't develop any android app and I therefore have no real clue if us using java 8 is a problem or not.

Maybe I am just paranoid, idk :D

I am fine with adjusting the default, I am also fine with leaving it as is. I would expect most people trying to build a library to adjust it themselves if needed.

Best regards, Marcel

marci4 commented 2 months ago

Removing support for 1.7 with #1434