我正在使用Java模块(Jigsaw)在单个maven模块中开发一个JavaFX应用程序。我的应用程序会运行,并且在Eclipse中没有出现错误或警告。现在我想导出一个正在运行的jar。
我试过了: mvn clean install javafx:jlink
并收到这个错误消息:"automatic module got be used with jlink: org.slf4j from file:///home/user1/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar“”
下面是我的module-info.class的样子:
//needed exports
exports myapp to javafx.graphics;
exports myapp.gui to javafx.fxml;
exports myapp.model to javafx.fxml;
opens myapp.gui to javafx.fxml;
// javafx
requires transitive javafx.base;
requires transitive javafx.controls;
requires transitive javafx.fxml;
requires transitive javafx.graphics;
// log4j
requires org.apache.logging.log4j.core;
requires org.apache.logging.log4j;
requires org.apache.logging.log4j.slf4j;
requires junit;
requires org.slf4j;有关于如何导出可运行jar的想法吗?
发布于 2020-04-20 15:20:25
答案很简单。jlink不支持自动模块。请看这里,看看如何规避这种情况:https://github.com/dlemmermann/JPackageScriptFX
发布于 2020-04-21 03:36:29
好吧,jlink仍然有问题。
这就是解决方案https://leward.eu/2020/01/20/java-module-slf4j-jlink-javafx.html
使用较新的slf4j (Alpha2.x)。
它简单地总结了每个需要成为jigsaw模块项目的模块……
https://stackoverflow.com/questions/61311745
复制相似问题