Не удалось создать JAVAFx, не удалось создать задачу или введите javafx: com.sun.javafx.tools.ant: resources - PullRequest
0 голосов
/ 29 марта 2019

Я пытаюсь запустить файл antbuild ниже для одного из моих проектов, но я не добился успеха, вот код моего build.xmlfile

<?xml version="1.0" encoding="UTF-8"?>
<project name="PlayerApplication" 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"/>
            <file name="${basedir}"/>
        </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:\PlayerTestCode\lib">
            <filename name="gson-2.1.jar"/>
        </fileset>
    </copy>
    <copy todir="externalLibs">
        <fileset dir="D:\PlayerTestCode\lib">
            <filename name="sqlite-jdbc-3.5.9-universal.jar"/>
        </fileset>
    </copy>

    <mkdir dir="project" />
    <copy todir="project">
        <fileset dir="D:\PlayerTestCode">
            <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="gson-2.1.jar"/>
            <include name="sqlite-jdbc-3.5.9-universal.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.8" target="1.8" srcdir="build/src" destdir="build/classes" encoding="Cp1252">
        <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="PlayerApplication.jar"/>
        <fx:fileset dir="dist" includes="libs/*"/>
        <fx:fileset dir="dist" includes="resources/**"/>
    </fx:resources>

    <fx:application id="fxApplication"
        name="MovementLibraryPlayer"
        mainClass="Demo1"
        toolkit="fx"
        version="1.0" 

    />

    <mkdir dir="build/classes/META-INF" />



    <fx:jar destfile="dist/PlayerApplication.jar">
        <fx:application refid="fxApplication"/>
        <fileset dir="build/classes">
        </fileset>
        <fx:resources refid="appRes"/>

        <manifest>
            <attribute name="Implementation-Vendor" value="MovementDynemics"/>
            <attribute name="Implementation-Title" value="MovementLibraryPlayer"/>
            <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
        verbose="true" 
        embedJNLP="false"
        extension="false"
        includeDT="false"
        offlineAllowed="true"
        outdir="${basedir}/deploy"
        outfile="PlayerApplication" nativeBundles="exe"
        updatemode="background" >

        <fx:platform basedir="${java.home}"/>
        <fx:info title="PlayerApplication" vendor="MovementDynemics"/>

        <fx:application refId="fxApplication"/>
        <fx:resources refid="appRes"/>
    </fx:deploy>


</target>

Когда я запускаю вышеуказанный файл в eclipse как сборка муравья, я получаю ошибку ниже Кто-нибудь имеет представление об этой ошибке? Что означают следующие строки?

 Buildfile: D:\PlayerTestCode\build\otherbuild\buildWin.xml
setup-staging-area:
   [delete] Deleting directory D:\PlayerTestCode\build\otherbuild\externalLibs
   [delete] Deleting directory D:\PlayerTestCode\build\otherbuild\project
   [delete] Deleting directory D:\PlayerTestCode\build\otherbuild\projectRefs
    [mkdir] Created dir: D:\PlayerTestCode\build\otherbuild\externalLibs
     [copy] Copying 1 file to D:\PlayerTestCode\build\otherbuild\externalLibs
     [copy] Copying 1 file to D:\PlayerTestCode\build\otherbuild\externalLibs
    [mkdir] Created dir: D:\PlayerTestCode\build\otherbuild\project
     [copy] Copying 63 files to D:\PlayerTestCode\build\otherbuild\project
    [mkdir] Created dir: D:\PlayerTestCode\build\otherbuild\projectRefs
do-compile:
   [delete] Deleting directory D:\PlayerTestCode\build\otherbuild\build
    [mkdir] Created dir: D:\PlayerTestCode\build\otherbuild\build\src
    [mkdir] Created dir: D:\PlayerTestCode\build\otherbuild\build\libs
    [mkdir] Created dir: D:\PlayerTestCode\build\otherbuild\build\classes
     [copy] Copying 2 files to D:\PlayerTestCode\build\otherbuild\build\libs
     [copy] Copying 63 files to D:\PlayerTestCode\build\otherbuild\build\src
    [javac] Compiling 26 source files to D:\PlayerTestCode\build\otherbuild\build\classes
    [javac] Note: D:\PlayerTestCode\build\otherbuild\build\src\FXMLDocumentController.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
     [copy] Copying 37 files to D:\PlayerTestCode\build\otherbuild\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 2 files to D:\PlayerTestCode\build\otherbuild\dist\libs

BUILD FAILED
D:\PlayerTestCode\build\otherbuild\buildWin.xml:97: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:resources

Я понятия не имею, где я неправ и где мне нужно искать. было бы здорово, если бы кто-то мог помочь мне разобраться.

Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...