在eclipse-SDK-4.2.1-win32-efx-0.8.0上部署我的javafx 2应用程序



我安装了eclipse-SDK-4.2.1-win32-efx-0.8.0用于javafx开发。我做了一个测试,我想要部署我的应用程序。我首先将它导出到ant中,并在我的项目

中得到这个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并运行" I have this error on console:

"
Buildfile: D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuild.xml
setup-staging-area:
   [delete] Deleting directory D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildexternalLibs
   [delete] Deleting directory D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildproject
   [delete] Deleting directory D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildprojectRefs
    [mkdir] Created dir: D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildexternalLibs
     [copy] Copying 1 file to D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildexternalLibs
    [mkdir] Created dir: D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildproject
     [copy] Copying 2 files to D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildproject
    [mkdir] Created dir: D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildprojectRefs
do-compile:
   [delete] Deleting directory D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuild
    [mkdir] Created dir: D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuildsrc
    [mkdir] Created dir: D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuildlibs
    [mkdir] Created dir: D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuildclasses
     [copy] Copying 1 file to D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuildlibs
     [copy] Copying 2 files to D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuildsrc
    [javac] Compiling 2 source files to D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuildclasses
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.0eclipseMyWorkPlaceNewtestbuilddistlibs
BUILD FAILED
D:eclipse-SDK-4.2.1-win32-efx-0.8.0eclipseMyWorkPlaceNewtestbuildbuild.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

我对蚂蚁一窍不通,请问我有什么问题?由于

它告诉你它不能加载JavaFX ant扩展

无法从资源加载定义com/sun/javafx/tools/ant/antlib.xml。但没有找到。再部署:

你为什么不使用build ?fxbuild文件生成ANT文件?

这是我的项目中的另一个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}..libant-javafx.jar"/>
                <file name="${java.home}libjfxrt.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.0eclipseMyWorkPlaceNewtestlib">
                <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.0eclipseMyWorkPlaceNewtestlib">
                <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.0eclipseMyWorkPlaceNewtest">
                <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 FilesJavajre7libjfxrt.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>

我真的不熟悉蚂蚁。这是我第一次使用它

相关内容

  • 没有找到相关文章