gpt4 book ai didi

deployment - 为 javafx 应用程序创建一个 bundle jar

转载 作者:行者123 更新时间:2023-12-05 02:23:33 25 4
gpt4 key购买 nike

我正在尝试使用 ANT 为我的 JavaFX 应用程序将所有库 bundle 到一个 jar 中。我发现以下 Creating a bundle jar with ant但无法让它工作。添加库 *.jar 文件可以在 <fx:jar> 中完成通过添加 <fileset> :

<fileset dir="build" includes="libs/*.jar"></fileset>

build目录包含:

build
|-- classes (compiled classes)
|-- libs (external libraries)
|-- src (sources)

生成的 jar 现在包含 libs包含所有库的目录。

我如何判断生成的 jar 应该查看 libs目录在 jar 内而不是在 jar 外?

谢谢!

最佳答案

谢谢jewesea!

我无法让这些库中的任何一个与 JavaFX 一起工作。但我发现了这个:https://community.oracle.com/message/10266894

所以在<fx:jar>之后我解压并重新打包所有库,它工作正常。

<target name="do-deploy-bundle" depends="init-properties, do-deploy-dist">
<property name="tmp.file" value="temp_final.jar"/>

<delete file="${dist.dir}/${app.jar}" />
<delete dir="${bundle-dist.dir}"/>
<mkdir dir="${bundle-dist.dir}"/>

<jar destfile="${bundle-dist.dir}/${tmp.file}" filesetmanifest="skip">
<zipgroupfileset dir="${dist.dir}" includes="*.jar" />
<zipgroupfileset dir="${dist.dir}/libs" includes="*.jar" />

<manifest>
<attribute name="Implementation-Vendor" value="${app.vendor}"/>
<attribute name="Implementation-Title" value="${app.name}"/>
<attribute name="Implementation-Version" value="${app.version}"/>
<!--<attribute name="Main-Class" value="com.javafx.main.Main" />-->
<attribute name="Main-Class" value="com.poterion.texovac.application.Main" />
<attribute name="JavaFX-Version" value="2.2" />
<attribute name="JavaFX-Feature-Proxy" value="None"/>
<!--<attribute name="JavaFX-Application-Class" value="com.poterion.texovac.application.Main" />-->
<attribute name="Created-By" value="JavaFX Packager" />
</manifest>
</jar>

<zip destfile="${dist.dir}/${app.jar}">
<zipfileset src="${bundle-dist.dir}/${tmp.file}" excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA , META-INF/maven/**,META-INF/*.txt" />
</zip>

<delete file="${bundle-dist.dir}/${tmp.file}" />
<delete dir="${bundle-dist.dir}"/>
</target>

关于deployment - 为 javafx 应用程序创建一个 bundle jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20990386/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com