我已经阅读了文档,但是我找不到使它工作的方法,我正在使用最新的JDK/Eclipse/Debian。
这是我的build.xml
<project name="PMRx" default="default" basedir="."
xmlns:fx="javafx:com.sun.javafx.tools.ant">
<property name="src.dir" location="src" />
<property name="build.dir" location="build" />
<property name="dist.dir" location="dist" />
<property name="docs.dir" location="docs" />
<property name="application.vendor.dir" location="Comelecinca" />
<property name="application.title.dir" location="PMRx" />
<property name="build.classes.dir" location="build/classes" />
<property name="certification.dir" location="/home/rafael/Workspace/Certification" />
<property name="application.title" location="Sistema de Monitoreo Remoto" />
<target name="default">
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml" uri="javafx:com.sun.javafx.tools.ant"
classpath=".:/usr/lib/jvm/java-7-oracle/lib/ant-javafx.jar" />
<!-- Details about application -->
<fx:application id="PMRx" name="Sistema de Monitoreo Remoto"
mainClass="pmrx.Ventana" />
<!-- Define what auxilary resources are needed -->
<fx:resources id="appRes">
<fx:fileset dir="dist" includes="lib/*.jar" />
</fx:resources>
<fx:jar destfile="${dist.dir}/pmrx.jar">
<!-- Define what to launch -->
<fx:application refid="PMRx" />
<!-- Define what classpath to use -->
<fx:resources refid="appRes" />
<manifest>
<attribute name="Implementation-Vendor" value="${application.vendor}" />
<attribute name="Implementation-Title" value="${application.title}" />
<attribute name="Implementation-Version" value="1.0" />
</manifest>
<!-- Define what files to include -->
<fileset dir="${build.classes.dir}" />
</fx:jar>
<fx:signjar keyStore="${certification.dir}/sopc.crt"
destdir="dist" alias="comelecinca" storePass="951753" keyPass="951753">
<fileset dir='dist/*.jar' />
</fx:signjar>
<fx:deploy outdir="${dist.dir}" embedJNLP="true"
outfile="${application.title}">
<fx:application refId="PMRx" />
<fx:resources refid="appRes" />
<fx:info title="Sample app: ${application.title}" vendor="${application.vendor}" />
<!-- Request elevated permissions -->
<fx:permissions elevated="true" />
</fx:deploy>
</target>
下面是我得到的错误:
BUILD FAILED
/home/rafael/Workspace/PMRx/build.xml:19: All filesets are empty.
对应以下行:
<fx:jar destfile="${dist.dir}/pmrx.jar">
解决:问题是我在fx:jar过程中为文件指定了一个空路径。
澄清一下,令人困惑的是错误指向第19行。但它只是告诉整个XML块(从第19行开始)是错误所在,实际上问题在内部部分之一,在本例中,问题是:
<fileset dir="${build.classes.dir}" />
我只是把dir的参数改为我真正存放。class文件的位置,问题就解决了。