JavaFX 8 - 如何使用 Maven 和 INNO 构建 EXE
JavaFX 8 - How to build EXE with Maven & INNO
我未能成功找到有关如何配置 Maven 以使用 Maven 从 JavaFX 构建 EXE 的工作解决方案。
使用 build.fxbuild 使用 E(fx)clipse 设置的项目效果很好,但是我更喜欢有一个 maven 项目,它具有依赖模块而不是基本的 ANT 构建。
我看到了一些关于 ZENJAVA 的评论 - 但看起来这个插件已经失去了所有的吸引力并且几乎已经死了。
有什么可以从 Maven 中捆绑 EXE 的东西吗?我的项目是一个企业项目,它将有多个项目和很多依赖项 - 所以我希望有一种简单有效的方法来管理所有这些。
谢谢
我能够使用 javafx-ant 任务完成此操作。
http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.myapp.application
我的应用程序
罐
1.0-快照
我的应用程序
http://www.somecompany.com
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<javafx.version>8.0</javafx.version>
</properties>
<repositories>
<repository>
<id>repo</id>
<url>file://${project.basedir}/lib/repo</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<!-- copy all dependencies of your app to target folder -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<configuration>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Main-Class>com.myApp.MainClass</Main-Class>
<implementation-version>1.0</implementation-version>
<JavaFX-Application-Class>com.myApp.MainClass</JavaFX-Application-Class>
</manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<!-- copy the properties files to the root location -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources-1</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/properties</outputDirectory>
<resources>
<resource>
<directory>properties</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<!-- define the deploy ANT task -->
<taskdef name="jfxdeploy" classname="com.sun.javafx.tools.ant.DeployFXTask"
classpathref="maven.plugin.classpath" />
<!-- define the JarSing ANT task -->
<!-- taskdef name="jfxsignjar" classname="com.sun.javafx.tools.ant.FXSignJarTask"
classpathref="maven.plugin.classpath" / -->
<jfxdeploy outdir="${project.build.directory}/deploy"
outfile="${build.finalName}" nativeBundles="all">
<info title="${project.name}" />
<!-- set the main class of your applcation -->
<application name="${project.name}"
mainClass="com.myApp.MainClass" />
<resources>
<fileset dir="${project.build.directory}" includes="*.jar" />
<fileset dir="${project.build.directory}/dependency"
includes="*.jar" />
<fileset dir="${project.build.directory}/properties" includes="*.properties"/>
</resources>
<!-- set your jvm args -->
<platform>
<jvmarg value="-Xms512m" />
<jvmarg value="-Xmx1024m" />
</platform>
</jfxdeploy>
<!-- you need to generate a key yourself -->
<!--jfxsignjar destdir="${project.build.directory}/deploy" keyStore="path/to/your/keystore"
storePass="yourPass" alias="yourAlias" keyPass="keyPass"> <fileset dir="${project.build.directory}/deploy"
includes="*.jar" /> </jfxsignjar -->
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ant-javafx</artifactId>
<version>${javafx.version}</version>
<systemPath>${java.home}/../lib/ant-javafx.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
<finalName>CashReceipts</finalName>
</build>
<dependencies>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>8.40.9</version>
</dependency>
<dependency>
<groupId>customJar</groupId>
<artifactId>custom</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
这个插件没有死,只是官方网站因为它产生的成本而被关闭了。
请查看 git 存储库以获取更多详细信息:https://github.com/javafx-maven-plugin/javafx-maven-plugin
我们的测试文件夹中有一些示例配置:https://github.com/javafx-maven-plugin/javafx-maven-plugin/tree/master/src/it
要仅构建 EXE 安装程序,您可以指定特定的捆绑程序(8.1.3 及更高版本)。
要使用该插件,只需将其放入您的构建插件中即可:
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.3-SNAPSHOT</version>
<configuration>
<mainClass>com.your.amazing.mavenized.javafxapplication</mainClass>
<bundler>EXE</bundler>
</configuration>
</plugin>
免责声明:我是该插件的维护者之一;)
我未能成功找到有关如何配置 Maven 以使用 Maven 从 JavaFX 构建 EXE 的工作解决方案。
使用 build.fxbuild 使用 E(fx)clipse 设置的项目效果很好,但是我更喜欢有一个 maven 项目,它具有依赖模块而不是基本的 ANT 构建。
我看到了一些关于 ZENJAVA 的评论 - 但看起来这个插件已经失去了所有的吸引力并且几乎已经死了。
有什么可以从 Maven 中捆绑 EXE 的东西吗?我的项目是一个企业项目,它将有多个项目和很多依赖项 - 所以我希望有一种简单有效的方法来管理所有这些。
谢谢
我能够使用 javafx-ant 任务完成此操作。
http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.myapp.application 我的应用程序 罐 1.0-快照 我的应用程序 http://www.somecompany.com
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<javafx.version>8.0</javafx.version>
</properties>
<repositories>
<repository>
<id>repo</id>
<url>file://${project.basedir}/lib/repo</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<!-- copy all dependencies of your app to target folder -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<configuration>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Main-Class>com.myApp.MainClass</Main-Class>
<implementation-version>1.0</implementation-version>
<JavaFX-Application-Class>com.myApp.MainClass</JavaFX-Application-Class>
</manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<!-- copy the properties files to the root location -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources-1</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/properties</outputDirectory>
<resources>
<resource>
<directory>properties</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<!-- define the deploy ANT task -->
<taskdef name="jfxdeploy" classname="com.sun.javafx.tools.ant.DeployFXTask"
classpathref="maven.plugin.classpath" />
<!-- define the JarSing ANT task -->
<!-- taskdef name="jfxsignjar" classname="com.sun.javafx.tools.ant.FXSignJarTask"
classpathref="maven.plugin.classpath" / -->
<jfxdeploy outdir="${project.build.directory}/deploy"
outfile="${build.finalName}" nativeBundles="all">
<info title="${project.name}" />
<!-- set the main class of your applcation -->
<application name="${project.name}"
mainClass="com.myApp.MainClass" />
<resources>
<fileset dir="${project.build.directory}" includes="*.jar" />
<fileset dir="${project.build.directory}/dependency"
includes="*.jar" />
<fileset dir="${project.build.directory}/properties" includes="*.properties"/>
</resources>
<!-- set your jvm args -->
<platform>
<jvmarg value="-Xms512m" />
<jvmarg value="-Xmx1024m" />
</platform>
</jfxdeploy>
<!-- you need to generate a key yourself -->
<!--jfxsignjar destdir="${project.build.directory}/deploy" keyStore="path/to/your/keystore"
storePass="yourPass" alias="yourAlias" keyPass="keyPass"> <fileset dir="${project.build.directory}/deploy"
includes="*.jar" /> </jfxsignjar -->
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ant-javafx</artifactId>
<version>${javafx.version}</version>
<systemPath>${java.home}/../lib/ant-javafx.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
<finalName>CashReceipts</finalName>
</build>
<dependencies>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>8.40.9</version>
</dependency>
<dependency>
<groupId>customJar</groupId>
<artifactId>custom</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
这个插件没有死,只是官方网站因为它产生的成本而被关闭了。
请查看 git 存储库以获取更多详细信息:https://github.com/javafx-maven-plugin/javafx-maven-plugin
我们的测试文件夹中有一些示例配置:https://github.com/javafx-maven-plugin/javafx-maven-plugin/tree/master/src/it
要仅构建 EXE 安装程序,您可以指定特定的捆绑程序(8.1.3 及更高版本)。
要使用该插件,只需将其放入您的构建插件中即可:
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.3-SNAPSHOT</version>
<configuration>
<mainClass>com.your.amazing.mavenized.javafxapplication</mainClass>
<bundler>EXE</bundler>
</configuration>
</plugin>
免责声明:我是该插件的维护者之一;)