当使用e(fx)clipse将JavaFX应用程序部署到.dmg (Mac OS)时,将出现“构建失败”错误

时间:2021-10-04 20:24:43

A “BUILD FAILED” error appears when deploying a JavaFX application to .dmg (Mac OS), using e(fx)clipse. However, the .jar produced during the build works.

当使用e(fx)clipse将JavaFX应用程序部署到.dmg (Mac OS)时,将出现“构建失败”错误。然而,.jar在构建过程中生成。

I'm attempting to deploy the AddressApp using this tutorial: http://code.makery.ch/library/javafx-8-tutorial/part7/ .

我正在尝试使用本教程部署AddressApp: http://code.makery。ch /图书馆/ javafx-8-tutorial / part7 /。

Any help would be greatly appreciated!

如有任何帮助,我们将不胜感激!

The Stacktrace, and Buildfile are below.

Stacktrace和Buildfile在下面。

Stacktrace:

加:

Buildfile: /Users/user/eclipse/AddressApp/build/build.xml
setup-staging-area:
   [delete] Deleting directory /Users/user/eclipse/AddressApp/build/externalLibs
   [delete] Deleting directory /Users/user/eclipse/AddressApp/build/project
   [delete] Deleting directory /Users/user/eclipse/AddressApp/build/projectRefs
    [mkdir] Created dir: /Users/user/eclipse/AddressApp/build/externalLibs
    [mkdir] Created dir: /Users/user/eclipse/AddressApp/build/project
     [copy] Copying 11 files to /Users/user/eclipse/AddressApp/build/project
    [mkdir] Created dir: /Users/user/eclipse/AddressApp/build/projectRefs
do-compile:
   [delete] Deleting directory /Users/user/eclipse/AddressApp/build/build
    [mkdir] Created dir: /Users/user/eclipse/AddressApp/build/build/src
    [mkdir] Created dir: /Users/user/eclipse/AddressApp/build/build/libs
    [mkdir] Created dir: /Users/user/eclipse/AddressApp/build/build/classes
     [copy] Copying 11 files to /Users/user/eclipse/AddressApp/build/build/src
    [javac] Compiling 8 source files to /Users/user/eclipse/AddressApp/build/build/classes
     [copy] Copying 3 files to /Users/user/eclipse/AddressApp/build/build/classes
init-fx-tasks:
do-deploy:
    [mkdir] Created dir: /Users/user/eclipse/AddressApp/build/build/classes/META-INF
Using base JDK at: /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk
Building DMG package for AddressApp
Did not find a key matching 'Developer ID Application: '

BUILD FAILED
/Users/user/eclipse/AddressApp/build/build.xml:122: Error: Bundler "DMG Installer" (dmg) failed to produce a bundle.

Total time: 20 seconds

build.xml:

build . xml:

<?xml version="1.0" encoding="UTF-8"?>
    <project name="AddressApp" default="do-deploy" basedir="."  xmlns:fx="javafx:com.sun.javafx.tools.ant">
    <target name="init-fx-tasks">
        <path id="fxant">
            <filelist>
                <file name="${java.home}\..\lib\ant-javafx.jar"/>
                <file name="${java.home}\lib\jfxrt.jar"/>
            </filelist>
        </path>

        <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
            uri="javafx:com.sun.javafx.tools.ant"
            classpathref="fxant"/>
    </target>
    <target name="setup-staging-area">
        <delete dir="externalLibs" />
        <delete dir="project" />
        <delete dir="projectRefs" />

        <mkdir dir="externalLibs" />


        <mkdir dir="project" />
        <copy todir="project">
            <fileset dir="/Users/user/eclipse/AddressApp">
                <include name="src/**" />
            </fileset>
        </copy>

        <mkdir dir="projectRefs" />
    </target>
    <target name='do-compile'>
        <delete dir="build" />
        <mkdir dir="build/src" />
        <mkdir dir="build/libs" />
        <mkdir dir="build/classes" />

        <!-- Copy project-libs references -->
        <copy todir="build/libs">
            <fileset dir="externalLibs">
            </fileset>
        </copy>

        <!-- Copy project references -->

        <!-- Copy project sources itself -->
        <copy todir="build/src">
            <fileset dir="project/src">
                <include name="**/*"/>
            </fileset>
        </copy>

        <javac includeantruntime="false" source="1.8" target="1.8" srcdir="build/src" destdir="build/classes" encoding="UTF-8">
            <classpath>
                <fileset dir="build/libs">
                    <include name="*"/>
                </fileset>
            </classpath>
        </javac>

        <!-- Copy over none Java-Files -->
        <copy todir="build/classes">
        <fileset dir="project/src">
            <exclude name="**/*.java"/>
        </fileset>
        </copy>


    </target>
    <target name="do-deploy" depends="setup-staging-area, do-compile, init-fx-tasks">
        <delete file="dist"/>
        <delete file="deploy" />

        <mkdir dir="dist" />
        <mkdir dir="dist/libs" />

        <copy todir="dist/libs">
            <fileset dir="externalLibs">
                <include name="*" />
            </fileset>
        </copy>


        <fx:resources id="appRes">
            <fx:fileset dir="dist" includes="AddressApp.jar"/>
            <fx:fileset dir="dist" includes="libs/*"/>
        </fx:resources>

        <fx:application id="fxApplication"
            name="AddressApp"
            mainClass=""
        />

        <mkdir dir="build/classes/META-INF" />



        <fx:jar destfile="dist/AddressApp.jar">
            <fx:application refid="fxApplication"/>
            <fileset dir="build/classes">
            </fileset>
            <fx:resources refid="appRes"/>

            <manifest>
                <attribute name="Implementation-Vendor" value="makery.ch"/>
                <attribute name="Implementation-Title" value="AddressApp"/>
                <attribute name="Implementation-Version" value="1.0"/>
                <attribute name="JavaFX-Feature-Proxy" value="None"/>
            </manifest>
        </fx:jar>


        <mkdir dir="deploy" />
        <!-- Need to use ${basedir} because somehow the ant task is calculating the directory differently -->
        <fx:deploy
            embedJNLP="false"
            extension="false"
            includeDT="false"
            offlineAllowed="true"
            outdir="${basedir}/deploy"
            outfile="AddressApp" nativeBundles="dmg"
            updatemode="background" >

            <fx:platform basedir="${java.home}"/>
            <fx:info title="AddressApp" vendor="makery.ch"/>

            <fx:application refId="fxApplication"/>
            <fx:resources refid="appRes"/>
        </fx:deploy>


    </target>
</project>

1 个解决方案

#1


2  

Was having the same issue. Had a popup on first build attempt which I ignored before I read it properly. So made sure that I didn't have any open drives/DMGs and then re-ran the build, and that then gave me the popup again. This time clicked the Install option, which then went off and found/downloaded some background tool the build used. That particular attempt failed, but after doing a re-eject and a re-build it then worked fine.

我也有同样的问题。在第一次构建尝试中有一个弹出窗口,我在正确阅读之前忽略了它。所以确保我没有任何打开的驱动器/DMGs,然后重新运行构建,然后再次弹出。这一次点击了安装选项,然后找到/下载了一些用于构建的后台工具。这一尝试失败了,但是在完成了一个reeject和重新构建之后,它运行良好。

#1


2  

Was having the same issue. Had a popup on first build attempt which I ignored before I read it properly. So made sure that I didn't have any open drives/DMGs and then re-ran the build, and that then gave me the popup again. This time clicked the Install option, which then went off and found/downloaded some background tool the build used. That particular attempt failed, but after doing a re-eject and a re-build it then worked fine.

我也有同样的问题。在第一次构建尝试中有一个弹出窗口,我在正确阅读之前忽略了它。所以确保我没有任何打开的驱动器/DMGs,然后重新运行构建,然后再次弹出。这一次点击了安装选项,然后找到/下载了一些用于构建的后台工具。这一尝试失败了,但是在完成了一个reeject和重新构建之后,它运行良好。