What makes Maven want openjfx with Zulu Java 11 and not Zulu Java 8 for a Spring Boot project?

This could be caused by HV-1644 Using Hibernate Validator with Java 11 brings JavaFX on the classpath if org.hibernate.validator:hibernate-validator:jar:6.0.11.Final is part of your dependencies. Updating to 6.0.12 or newer should solve it.


Recently I ran into the same problem with building an artifact using Maven with JDK 11. Some dependency was specified to use the artifact org.openjfx:javafx.base:11.0.0-SNAPSHOT (JavaFX, which is no more part of Java 11). So Maven always wanted to download this artifact, which - in fact - did not exist in our Maven repository. So building subsequently failed as did analyzis of the dependency tree. I could not determine, where this artifact would be used.

I googled for this artifact's usages and found this bug issue in Maven JIRA about Hibernate: Dependency resolution broken with Java 11 (MNG-6500).

There it is said that in Hibernate 6.0.11 this artifact was specified in the POM of org.hibernate.validator:hibernate-validator:6.0.11.Final. But I was not aware of any usage of this Hibernate dependency within my project. I searched the whole local Maven repository for this artifact. And what a surprise, the mentioned Hibernate artifact was used by org.glassfish.jersey.ext:jersey-bean-validation:jar:2.28 (which has a parent org.glassfish.jersey:project:2.28 in the parent chain where hibernate-validator's version is specified). And this dependency in turn was used by io.confluent:kafka-schema-registry:jar:5.4.0.

So the only thing I had to do is to exclude this JavaFX artifact from io.confluent:kafka-schema-registry:jar:5.4.0 dependency:

<dependency>
    <groupId>io.confluent</groupId>
    <artifactId>kafka-schema-registry</artifactId>
    <version>5.4.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx.base</artifactId>
        </exclusion>
    </exclusions>
</dependency>