Reputation: 53
Following this tutorial, http://code.makery.ch/library/javafx-8-tutorial/part7/, I have been having some trouble in deployment for my javaFX application using OS X.
Here is the build.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Dogsled" 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/steveli/Documents/workspace/Dogsled">
<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="Dogsled.jar"/>
<fx:fileset dir="dist" includes="libs/*"/>
</fx:resources>
<fx:application id="fxApplication"
name="RaceTimer"
mainClass="sled.timer.address.MainApp"
/>
<mkdir dir="build/classes/META-INF" />
<fx:jar destfile="dist/Dogsled.jar">
<fx:application refid="fxApplication"/>
<fileset dir="build/classes">
</fileset>
<fx:resources refid="appRes"/>
<manifest>
<attribute name="Implementation-Vendor" value="Steve Li"/>
<attribute name="Implementation-Title" value="RaceTimer"/>
<attribute name="Implementation-Version" value="1.3"/>
<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
verbose="true"
embedJNLP="false"
extension="false"
includeDT="false"
offlineAllowed="true"
outdir="${basedir}/deploy"
outfile="Dogsled" nativeBundles="dmg"
updatemode="background" >
<fx:platform basedir="${java.home}"/>
<fx:info title="Dogsled" vendor="Steve Li"/>
<fx:application refId="fxApplication"/>
<fx:resources refid="appRes"/>
</fx:deploy>
</target>
And here is the console output:
BUILD FAILED
/Users/steveli/Documents/workspace/Dogsled/build/build.xml:123: Error: Bundler "DMG Installer" (dmg) failed to produce a bundle.
Essentially what happens is that whenever I try to build, the .dmg doesn't appear within deploy/bundles folder. I tried deleting the build folder and rebuilding several times, but to no avail. Any other solutions I have found online doesn't work.
Note: I'm using eclipse with the e(fx)clipse plugin.
Any help is appreciated.
Upvotes: 0
Views: 1443
Reputation: 181
In mac the dmgs are read only disk images that are created whenever you create a dmg. Sometimes this can get into a wierd state. So open DiskUtility and eject all the old diskimages that look like your project name and re-run the build.
If it still gives an error, wave your hand and try a tool like install4j [ https://www.ej-technologies.com/products/install4j/overview.html ] or amipackage [ https://amidb.com/amipackage ]
Upvotes: 4