Wednesday, 10 July 2024

Troubleshooting Maven JavaFX Dependency Issues on Multiple OS Platforms

Developing JavaFX applications with Maven can sometimes hit a snag, particularly when dealing with dependency resolution across different operating systems. This blog post explores a common issue faced by developers when Maven fails to resolve JavaFX dependencies, particularly when transitioning between Linux, Windows, and macOS environments.

The Issue 

When attempting to run mvn clean install on a Maven project that includes JavaFX dependencies, developers may encounter the following error on Windows or macOS, despite the setup working flawlessly on Linux:

[ERROR] Failed to execute goal on project RNGame: Could not resolve dependencies for project com.ceebee:RNGame:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.openjfx:javafx-controls:jar:${javafx.platform}:21.0.3 (absent), org.openjfx:javafx-graphics:jar:${javafx.platform}:21.0.3 (absent), org.openjfx:javafx-base:jar:${javafx.platform}:21.0.3 (absent), org.openjfx:javafx-fxml:jar:${javafx.platform}:21.0.3 (absent), org.openjfx:javafx-media:jar:${javafx.platform}:21.0.3 (absent): Could not find artifact org.openjfx:javafx-controls:jar:${javafx.platform}:21.0.3 in central (https://repo.maven.apache.org/maven2)

This error indicates that Maven cannot resolve the JavaFX dependencies due to an issue with the platform-specific classifier ${javafx.platform}.

Read more »

Labels: