使用e(fx)clipse

时间:2016-01-01 21:51:58

标签: java eclipse macos deployment dmg

使用e(fx)clipse将JavaFX应用程序部署到.dmg(Mac OS)时出现“BUILD FAILED”错误。但是,在构建期间生成的.jar。

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

非常感谢任何帮助!

Stacktrace和Buildfile位于下方。

堆栈跟踪:

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:

<?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 个答案:

答案 0 :(得分:3)

遇到了同样的问题。在第一次构建尝试时有一个弹出窗口,在我正确阅读之前我忽略了它。因此确保我没有任何打开的驱动器/ DMG,然后重新运行构建,然后再次给我弹出窗口。这次单击了Install选项,然后关闭并找到/下载了一些使用的构建的后台工具。该特定尝试失败,但在重新弹出并重新构建之后,它工作正常。