MaterialFX
MaterialFX copied to clipboard
The :demo:compileJava Gradle task fails on Java 18
Describe the bug
The README says MaterialFX requires Java 11 and above:
Build
To build MaterialFX, execute the following command:
gradlew build
To run the main demo, execute the following command:
gradlew run
NOTE: MaterialFX requires Java 11 and above.
And, as far as I know, the actual library works just fine with Java 18. But the demo
project fails to compile if Gradle is running on Java 18. Here's the pertinent part of the error shown in the MRE section:
* What went wrong:
Execution failed for task ':demo:compileJava'.
> Unsupported class file major version 62
If you run Gradle with --stacktrace
you'll see the problem seems to be with Gradle's version of ASM. In fact, updating the Gradle wrapper to 7.5.1
(the latest release as of posting this issue) appears to solve the problem.
MRE(Minimal Reproducible Example)
No MRE, as this bug is related to building the project itself. However, here is the error (plus some version info):
...\MaterialFX> $env:java_home
C:\Program Files\Eclipse Adoptium\jdk-18.0.2.9-hotspot\
...\MaterialFX> ./gradlew --version
------------------------------------------------------------
Gradle 7.3.3
------------------------------------------------------------
Build time: 2021-12-22 12:37:54 UTC
Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 18.0.2 (Eclipse Adoptium 18.0.2+9)
OS: Windows 10 10.0 amd64
...\MaterialFX> ./gradlew run --console plain
> Configure project :
Project :demo => 'MaterialFX.Demo' Java module
Project :materialfx => 'MaterialFX' Java module
> Task :demo:configJavafxRun
> Task :materialfx:compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :materialfx:processResources
> Task :materialfx:classes
> Task :materialfx:jar
warning: Unused Export-Package instructions: [io.github.palexdev.materialfx.demo.*]
> Task :demo:compileJava FAILED
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':demo:compileJava'.
> Unsupported class file major version 62
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8s
5 actionable tasks: 5 executed
To Reproduce
-
git clone https://github.com/palexdev/MaterialFX.git
-
cd MaterialFX
-
./gradlew run
Make sure to have JAVA_HOME
or org.gradle.java.home
set to JDK 18.
Expected behavior
The demo should compile and run normally.
Screenshots
N/A
Java 11 and above but always in the limits imposed by Gradle of course
In the next versions it will be upgraded
This should have been fixed by 2744609