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>
Maven plugin for JavaFX 1 Install. The plugin is available via Maven Central. 2 Usage. Create a new Maven project, use an existing one like HelloFX, or use an archetype. The project can be modular or... 3 Issues and Contributions. Issues can be reported to the Issue tracker. Contributions can be submitted via Pull requests... More ...
Upgrade the spring boot version to 2.1.X since 2.0.X and older versions does not support Java 11. In our project, we have gone for 2.3.4.RELEASE version. Upgrading the spring boot to 2.3.4.RELEASE will also upgrade its corresponding dependencies like Click here to find the complete list of dependencies and its compatible versions.
In case you want to build and install the latest snapshot, you can clone the project, set JDK 11 and run Create a new Maven project, use an existing one like HelloFX, or use an archetype. The project can be modular or non-modular.
If you are using the older version of maven, upgrade it the latest version and also update the source and target to 11. 3. Spring Boot Upgrade the spring boot version to 2.1.X since 2.0.X and older versions does not support Java 11. In our project, we have gone for 2.3.4.RELEASE version.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With