Joe*_*ore 4 java maven javafx-8
我有一个简单的JavaFX应用程序,我想为Windows机器创建一个安装程序.该javafx-maven-plugin作品,并创建一个Windows安装沿应用程序的可执行文件,但问题是,它创建了内部的JavaFX应用程序在Windows安装程序以及完整的JRE太大.
那么,如何在javafx-maven-plugin不使用完整的Java框架的情况下为Windows构建本机文件.也许它应该只创建一个Java Framework的依赖.这使安装程序从1.5MB到200MB的磁盘空间膨胀.
使用Maven我使用该命令mvn clean compile jfx:build-jar jfx:native获取Windows中的本机文件,这是我正在使用的POM文件:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo</groupId>
<artifactId>hello-javafx-maven-example</artifactId>
<name>JavaFX Example Maven Project</name>
<organization>
<name>Jaa Demo</name>
</organization>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.3</version>
<configuration>
<mainClass>com.demo.helloWorld</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
我是那个javafx-maven-plugin的维护者.
在创建安装程序时,"按设计"是将JRE捆绑在应用程序中.我自己也偶然发现了这一点,但是尽管有oracle的当前文档,但我发现无法运行我生成的文件(使用JDK 1.8u40及更高版本,Windows)而没有将JRE放在我的本机启动器旁边.packager.dll似乎要求它在那里.但要说清楚:这对我来说可能只是一个问题,没有经过验证,我也没有对此进行调查.
要回答您的问题:您可以通过传递一些bundleArguments来删除JRE:
<bundleArguments>
<runtime />
</bundleArguments>
Run Code Online (Sandbox Code Playgroud)
我自己这样做,主要是为了加速测试项目,比如:https: //github.com/javafx-maven-plugin/javafx-maven-plugin/blob/master/src/it/03-cli- JFX-本地/ pom.xml的#L31
编辑:请考虑升级到插件版本8.1.5,因为有一些错误修复,包括(恕我办事)严重的解决方案在Linux系统上的本机启动器.在正常的maven-lifecycle中也支持创建包:https://github.com/javafx-maven-plugin/javafx-maven-plugin/blob/master/src/it/07-lifecycle-build-jfx-native /pom.xml
| 归档时间: |
|
| 查看次数: |
2672 次 |
| 最近记录: |