如何构建一个罐子文件,包括所有所需的Javafx模块
我有一个(非模块化的)Javafx应用程序,该应用程序从命令行运行良好,因为我给命令行的参数 - 模块path和-add-modules包含javafx模块(在我的情况下,我使用
--module-path /home/user/libs/javafx_libs --add-modules javafx.controls,javafx.fxml,javafx.web
这很好,因为我知道我在哪里安装了我的javafx文件(即/home/user/libs/javafx_libs)
。 但是,
- 不是使用某些手动提取目录的位置,而是在一个单个应用程序中使用Maven依赖性,而
- 任何平台特定的依赖项
没有 Maven依赖项看起来像:
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${version.javafx}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${version.javafx}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>${version.javafx}</version>
</dependency>
据我了解,我必须使我的完整应用模块化,这对我来说是(另一件)新事物,但是第一个基本步骤已经完成(添加了一个module-info.java文件,并添加了“需要” - 我想构建此应用程序
,
- 以便我可以在没有这些模块路径和模块的情况下
- 开始 。我可以在一个单个JAR文件中构建它吗?
- 如何在Maven中完成这样的构建?也就是说,我需要以这种方式构建哪个插件,以及如何在Maven中配置这些插件?
我也可以通过获得一些好书(或其他出版物)的链接来帮助我。
I have a (non-modular) JavaFX application that runs well from the command line, as I give to the command line the arguments --module-path and --add-modules to include the javafx modules (in my case, I use
--module-path /home/user/libs/javafx_libs --add-modules javafx.controls,javafx.fxml,javafx.web
This works fine, because I know where I had manually installed my javafx files (i.e. in /home/user/libs/javafx_libs).
However, I now want to build it, but
- not using some manual extraction directory location, but using maven dependencies, and
- in one single application jarfile without any platform-specific dependencies.
So my maven dependencies look like :
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${version.javafx}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${version.javafx}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>${version.javafx}</version>
</dependency>
As far as I understand, I have to make my complete application modular, which is (another) new thing to me, but the first basic steps have been completed (added a module-info.java file, and added it's "requires"- statements). I want to build this application so that I can start it without these module paths and module additions.
My questions are:
- Where can I then find the location of Maven's repository's JavaFX files,
- How can I build this in one single jar file, and
- How is such a build done in Maven? That is, which plugins do I need to build it this way, and how do I configure these plugins in Maven?
I may also be helped by getting a link to some good book (or to some other publication) where this is explained.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论