我可以使用JavaFX原生构建工具拥有多个可执行文件吗? [英] Can I have more than one executable file with JavaFX native building tool?
问题描述
我使用 JavaFX Gradle插件构建我的JavaFX应用程序。是否有可能用不同的主类构建多个可执行文件?如果是这样,怎么样?
这是可能的,因为底层 javapackager
支持这一点。
正如我理解你是正确的,你有一个项目,你有多个入口点,现在你想创建本地启动器/二进制文件对于每个入口点。这在Gradle插件中称为辅助启动器,甚至在 javapackager
中也称为辅助启动器。
创建多个可执行文件相同的包,只需将其添加到您的构建文件中:
jfx {
// ...正常配置...
//您的辅助入口点,每个将创建一个本地可执行文件(每个文件为一个.cfg文件)
secondaryLaunchers = [
// second可执行文件
[
appName:'somethingDifferent'
//将创建相同的可执行文件,只是名称不同(所以这只是演示用途)
],
//第三个可执行文件
[
appName:'somethingDifferent2',
//指定您的不同入口点
mainClass:'your.different.entrypoint.MainApp'
//其他可能的条目:jfxMainAppJarName,jvmProperties,jvmArgs,userJvmArgs, nativeReleaseVersion,needShortcut,needMenu,vendor,identifier
]
]
}
免责声明:我是JavaFX Gradle插件的创建者;)
I'm using the JavaFX Gradle plugin to build my JavaFX application. Is it possible to have more than one executable built with different main classes? If so, how?
This is possible, as the underlying javapackager
does support this.
As I'm understanding you correct, you have a project, where you have multiple entry-points and now you want to create native launchers/binaries for each of that entry-point. This is called "secondary launcher" inside the gradle plugin and even inside the javapackager
.
To create multiple executables with the same bundle, just add this inside your buildfile:
jfx {
// ... normal configuration ...
// your secondary entry points, each will create a native executable (and one .cfg-file for each)
secondaryLaunchers = [
// second executable
[
appName: 'somethingDifferent'
// will create the same executable, just with a different name (so this is demo-purpose only)
],
// third executable
[
appName: 'somethingDifferent2',
// specify your different entry-point
mainClass: 'your.different.entrypoint.MainApp'
// other possible entries: "jfxMainAppJarName", "jvmProperties", "jvmArgs", "userJvmArgs", "nativeReleaseVersion", "needShortcut", "needMenu", "vendor", "identifier"
]
]
}
Disclaimer: I'm the creator of the JavaFX Gradle plugin ;)
这篇关于我可以使用JavaFX原生构建工具拥有多个可执行文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!