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

Viewed 5276

I have inherited a Spring Boot project where we would like to use Java 11 for testing due to the nice features added in Java 9 and 10 (var and List.of(...)).

The Maven project is split up in several parts where the code for production is set up for Java 8, and the test code for Java 11. This works nicely individually on module basis and the global build works with Java 8 (except for the tests failing to compile) and Java 10.

Now I want to compile everything from the root using Java 11 due to this being the LTS (Zulu as this is on Windows 10), and for some reason Maven now wants to pull in org.openjfx:javafx.base:jar:11.0.0-SNAPSHOT

[INFO] Building mumble-data-service-parent 1.0.0-SNAPSHOT              
[1/8]
[INFO] --------------------------------[ pom ]---------------------------------
[WARNING] The POM for org.openjfx:javafx.base:jar:11.0.0-SNAPSHOT is missing, no dependency information available
[INFO]

As the dependencies are not satisfied I cannot (at least not in a way I can think of) get Maven to tell me why it wants to do this so I have no idea where to look, and the project does not appear to reference javafx in the first place (being a Spring Boot microservice that would surprise me a bit). Hence this question.

What causes it, and how do I fix it?


As correctly deduced by Karol this issue was seen before and the fix was to upgrade the hibernate validator dependency to a newer version. All that was needed for me was to add the following property to my parent pom:

    <!-- needed for building with Java 11 -->
    <hibernate-validator.version>6.0.12.Final</hibernate-validator.version>
2 Answers

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>
Related