我为javafx developpement安装了eclipse-SDK-4.2.1-win32-efx-0.8.0。 我做了测试,我想部署我的应用程序。 我首先将它导出到ant并在我的projet中获取此ant文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. --><project basedir="." default="build" name="Newtest">
<property environment="env"/>
<property name="ECLIPSE_HOME" value="../../"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.7"/>
<property name="source" value="1.7"/>
<path id="JavaFX SDK.libraryclasspath">
<pathelement location="C:/Program Files/Java/jre7/lib/jfxrt.jar"/>
</path>
<path id="Newtest.classpath">
<pathelement location="bin"/>
<path refid="JavaFX SDK.libraryclasspath"/>
<pathelement location="lib/jfxtras-labs-2.2-r4.jar"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="Newtest.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
<target name="Test">
<java classname="app.TEst" failonerror="true" fork="yes">
<classpath refid="Newtest.classpath"/>
</java>
</target>
</project>
然后点击“ 生成ant build.xml并运行“我在控制台上有这个错误:
Buildfile: D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build.xml
setup-staging-area:
[delete] Deleting directory D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\externalLibs
[delete] Deleting directory D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\project
[delete] Deleting directory D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\projectRefs
[mkdir] Created dir: D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\externalLibs
[copy] Copying 1 file to D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\externalLibs
[mkdir] Created dir: D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\project
[copy] Copying 2 files to D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\project
[mkdir] Created dir: D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\projectRefs
do-compile:
[delete] Deleting directory D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build
[mkdir] Created dir: D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build\src
[mkdir] Created dir: D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build\libs
[mkdir] Created dir: D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build\classes
[copy] Copying 1 file to D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build\libs
[copy] Copying 2 files to D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build\src
[javac] Compiling 2 source files to D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build\classes
init-fx-tasks:
[taskdef] Could not load definitions from resource com/sun/javafx/tools/ant/antlib.xml. It could not be found.
do-deploy:
[copy] Copying 1 file to D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\dist\libs
BUILD FAILED
D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\build\build.xml:93: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:resources
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
Total time: 14 seconds
我对蚂蚁一无所知,请问我的问题是什么? 感谢
答案 0 :(得分:0)
因此它告诉您它无法加载JavaFX ant扩展
无法从资源加载定义 COM /阳光/ JavaFX的/工具/ ANT / antlib.xml。它无法找到。 DO-部署:
为什么不使用build.fxbuild文件生成ANT文件?
答案 1 :(得分:0)
这是我项目中的另一个ant文件:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Newtest" 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" />
<copy todir="externalLibs">
<fileset dir="D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\lib">
<filename name="jfxtras-labs-2.2-r4.jar"/>
</fileset>
</copy>
<copy todir="externalLibs">
<fileset dir="D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest\lib">
<filename name="ant-javafx.jar"/>
</fileset>
</copy>
<mkdir dir="project" />
<copy todir="project">
<fileset dir="D:\eclipse-SDK-4.2.1-win32-efx-0.8.0\eclipse\MyWorkPlace\Newtest">
<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">
<include name="ant-javafx.jar"/>
<include name="jfxtras-labs-2.2-r4.jar"/>
</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.7" target="1.7" srcdir="build/src" destdir="build/classes" encoding="Cp1252">
<classpath>
<fileset dir="build/libs">
<include name="*"/>
</fileset>
<filelist>
<file name="C:\Program Files\Java\jre7\lib\jfxrt.jar"/>
</filelist>
</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="Newtest.jar"/>
<fx:fileset dir="dist" includes="libs/*"/>
</fx:resources>
<fx:application id="fxApplication"
name="Newtest"
mainClass="app.TEst"
/>
<mkdir dir="build/classes/META-INF" />
<fx:jar destfile="dist/Newtest.jar">
<fx:application refid="fxApplication"/>
<fileset dir="build/classes">
</fileset>
<fx:resources refid="appRes"/>
<manifest>
<attribute name="Implementation-Vendor" value="Menguelenium"/>
<attribute name="Implementation-Title" value=""/>
<attribute name="Implementation-Version" value="0.0"/>
</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"
width="400" height="350"
includeDT="false"
offlineAllowed="true"
outdir="${basedir}/deploy"
outfile="Newtest"
updatemode="background" >
<fx:info title="Newtest" vendor="Menguelenium"/>
<fx:application refId="fxApplication"/>
<fx:resources refid="appRes"/>
</fx:deploy>
</target>
</project>
请与蚂蚁真相关。这是我第一次使用它。