I have three modules named core, common and item and each module is a child module to the Maven project. I'm using ServiceLoader to achieve a service approach and Java 11 with fontawesomefx 11 (lastest).
I have not worked with Java's module system, so I have no idea if I'm doing it correct with the module-info files. Nevertheless, the core and item module both requires a module of fontawesomefx and it results with this error:
Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package license in both module de.jensd.fx.fontawesomefx.materialicons and module de.jensd.fx.fontawesomefx.materialdesignicons
module-info for all submodules:
module common {
requires javafx.graphics;
requires javafx.controls;
requires de.jensd.fx.fontawesomefx.commons;
exports common.abstractions;
exports common.services;
exports common.sidebar;
opens common.services;
}
module core {
requires common;
requires javafx.controls;
requires javafx.fxml;
requires de.jensd.fx.fontawesomefx.materialdesignicons;
uses common.services.ISidebarPlugin;
exports core.ui to javafx.graphics;
exports core.ui.mainpage to javafx.fxml;
exports core.ui.sidebar to javafx.fxml;
opens core.ui.mainpage to javafx.fxml;
opens core.ui.sidebar to javafx.fxml;
}
module item {
requires common;
requires de.jensd.fx.fontawesomefx.materialicons;
provides common.services.ISidebarPlugin with item.sidebar.ItemSidebarPlugin;
}
If I remove the provides common.services.ISidebarPlugin with item.sidebar.ItemSidebarPlugin;
the application works, but without the item module because the implementation will not be loaded by the ServiceLoader.