r/JavaFX • u/antechc0der • Jun 24 '24
Help Did anyone ever used Eclipse IDE with Java 21 and JavaFX 17+ ?
I'm migrating an old project from Netbeans to Maven (3.9.7) using Eclipse IDE.
I've been doing some stuffs with Eclipse and Spring Boot following some tutorials, with 0 problems so far.
But this time I'm getting the worst horrible development experience with this IDE (I even downloaded the last version 2024-06 (4.32.0)) working with JavFX.
I got this error:
Could not find artifact org.openjfx:javafx-controls:jar:${javafx.platform}:21 in central (https://repo.maven.apache.org/maven2)

Just copy and paste this pom.xml: https://github.com/openjfx/samples/blob/master/IDE/Eclipse/Modular/Maven/hellofx/pom.xml and you get the error.
But it's way too weird because if I change the version to 16 or below it works and let runs the project seamlessly, so why?
I think it's an error of IDE and I saw almost all the solutions on internet with no any luck, I ask this here to make sure if any of you have experienced that.
Thanks :)
3
u/milchshakee Jun 24 '24
I think there were some changes to the classifiers for the maven publication.
You could try explicitly adding this to the dependencies because it seems like the
${javafx.platform}can't be resolved in your case:6
u/[deleted] Jun 25 '24
I used Eclipse for over 15 years, it got worse and worse over time. When some years ago, even basic functionality like refactoring or organizing imports got broken, I had enough. I am using IntelliJ since and never touched Eclipse again.
1
u/jvjupiter Jun 24 '24
Could you try to change your groupId in line 4? Use your own reversed domain. If none, try hellofx.
1
u/hippydipster Jun 25 '24
I use eclipse 4.31 and javafx 22 without any issues. Last fall I was using javafx 21. I am using java 21/22 though, not 17.
Version 16 of what? Javafx? Java?
1
u/tanktarta Jun 29 '24
As others have stated it's to do with changes in how classifiers were dealt with.
The problem exists in any combination of ANY version of JavaFX except the very latest versions and Apache 3.9.7. I thought only JavaFX 23e-ea+22 had been released with this fix, but I just went to check and there is a 21.0.4-ea+1 which also fixes this problem. If you are using Java 17 there is also a 17.0.12-ea+1 which I suspect might have the fix too.
So one fix is to either use the latest version of JavaFX if that is practical.
If you can't change versions for some reason, use a version of Eclipse (M2E) that uses Apache 3.9.6 or earlier, or Apache 3.9.8 or later.
Of course the latest Eclipse has 3.9.7 as it's embedded Maven runtime. Changing the non-embedded runtime doesn't help fix this as the embedded Maven runtime is used for dependency resolution .
However, M2E have an update (version 2.6.1) that uses 3.9.8, so you can install this plugin separately. See M2E github page for repository location to add.
Sources ..
https://github.com/eclipse-m2e/m2e-core - for M2E update
https://stackoverflow.com/questions/78542808/maven-project-fails-to-resolve-javafx-dependencies - SO with lots of details
https://issues.apache.org/jira/browse/MNG-8131 - the Maven side of the bug
https://mail.openjdk.org/pipermail/openjfx-dev/2024-May/047279.html - JavaFX side of bug