LayerInstantiationException的任何解决方案-两个模块中的软件包许可证?

时间:2019-03-30 16:02:29

标签: font-awesome java-11 java-module javafx-11

我有三个名为core,common和item的模块,每个模块都是Maven项目的子模块。我正在使用ServiceLoader实现服务方法,并使用fontawesomefx 11(最新)来实现Java 11。

我还没有使用Java的模块系统,所以我不知道我是否对module-info文件正确。但是,核心和项目模块都需要一个fontawesomefx模块,并且会导致以下错误:

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 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;
}

如果我删除provides common.services.ISidebarPlugin with item.sidebar.ItemSidebarPlugin;,则该应用程序可以运行,但没有item模块,因为该实现将不会被ServiceLoader加载。

0 个答案:

没有答案