对于常规的 netbeans javaFX 项目,开发人员能够执行以下操作 - 制作一个javaFX jar 文件 -在浏览器上使用javaFX制作一个html -制作一个jnlp webstart
我想用ant构建(在netbeans IDE中)实现相同的输出,但到目前为止我的成功仅限于javaFX jar文件,我也想用ant制作html文件和jnlp
我正在使用netbeans 8.0.2,我有一个标准java库(非javaFX)项目,该项目包含一个后端和两个前端SWING和javaFX,使用ant构建脚本我成功地生成了两个单独的和 self 的包含 jar 文件,即 dssSWING.jar 和 dssJavaFX.jar,每个文件都能够自解压其中的数据库,并在每个文件中嵌入第三方依赖项,这是我用来生成这两个文件的 ant 代码
<小时/><!--this build target is meant for building the AJAX SWING (web version) and the Desktop version-->
<target name="_desktop_SWING_RedistributableSingleJarFile">
<jar destfile="${basedir}/dss.jar">
<zipgroupfileset dir="protected/lib" includes="h2-1.4.182.jar"/>
<zipgroupfileset dir="protected/lib" includes="commons-csv-1.0.jar"/>
<fileset dir="${basedir}/build/classes">
<exclude name=".netbeans_automatic_build"/>
<exclude name=".netbeans_update_resources"/>
<exclude name="mobileView/**"/>
</fileset>
<fileset dir="protected/data" includes="dss.mv.db" />
<fileset dir="img" >
<exclude name="Thumbs.db"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="desktopView.WelcomePage"/>
</manifest>
</jar>
</target>
<!--this build target is meant for building the JavaFX version-->
<target name="_desktop_javaFX_RedistributableSingleJarFile">
<jar destfile="${basedir}/dss_javaFX.jar">
<zipgroupfileset dir="protected/lib" includes="h2-1.4.182.jar"/>
<zipgroupfileset dir="protected/lib" includes="commons-csv-1.0.jar"/>
<zipgroupfileset dir="protected/lib" includes="jfxtras-labs-8.0-r4-20141129.090224-39.jar"/>
<fileset dir="${basedir}/build/classes">
<exclude name=".netbeans_automatic_build"/>
<exclude name=".netbeans_update_resources"/>
<exclude name="desktopView/**"/>
</fileset>
<fileset dir="protected/data" includes="dss.mv.db" />
<fileset dir="img" >
<exclude name="Thumbs.db"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="mobileView.Main"/>
</manifest>
</jar>
</target>
<小时/>
请不要告诉将其放入 javaFX 项目(简单的出路),我想学习确切的 ant 脚本来生成嵌入 javaFX jar 文件以及 jnlp 文件的 HTML 文件
最佳答案
This website应该告诉您需要了解的一切,以及 ant 部署任务中发生的情况,因此,它还包含指向所有 ant 任务和创建 jnlp 等内容所需的设置的链接等
TL;DR,您与 ant-javafx.jar 交互,“重载”(或在 ant 世界中您所说的任何名称)fx:deploy 任务,设置一些属性,然后神奇的事情发生了。
如果您想了解 netbeans 如何处理 .jnlp 创建的细节,我将(最)相关的(3000 行).xml 文件上传到了 Pastebin,地址为 http://pastebin.com/hRBpMuUG
希望有帮助......祝你好运!
关于java - 自定义 Ant 构建和 JavaFX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27395408/