gradlejavafxgroovymoduleannotations

Class referred in Annotation cannot be found


In this project: https://github.com/wise-coders/groovyfx., a fork of GroovyFX (see source code). Upgrading to OpenJDK 17 and Gradle 7.6 I get this error (which did not happen under Java 8):

Could not find class for Transformation Processor groovyx.javafx.beans.FXBindableASTTransformation declared by groovyx.javafx.beans.FXBindable

The FXBindableASTTransformation is used as annotation in FXBindable. How can I prevent this error?

You can test it by executing

cd groovyfx
gradlew build
gradlew runAccordionDemo

Solution

  • The JavaFX library has undergone significant changes, and starting from Java 11, it is no longer bundled with the JDK. Ensure you have the correct JavaFX dependencies and they are compatible with Java 17.

    Solution: Add the necessary JavaFX dependencies to your project:

    dependencies {
        implementation 'org.openjfx:javafx-controls:17.0.1'
        implementation 'org.openjfx:javafx-fxml:17.0.1'
    }
    

    Debugging Tips: Run your application with --show-module-resolution to see how modules are resolved and identify any issues. Ensure that your IDE or build tool is correctly configured to use the Java 17 JDK.