简体   繁体   English

JavaFX 11 部署失败:无法创建任务或键入 javafx:com.sun.javafx.tools.ant:fileset

[英]JavaFX 11 Deployment Failure: failed to create task or type javafx:com.sun.javafx.tools.ant:fileset

I am trying to deploy my project but I keep receiving the following errors, what should I do ?我正在尝试部署我的项目,但我不断收到以下错误,我该怎么办? Also, I have java 11 but I can only select project language levels up to 10 in IntelliJ, yet I can use "var" syntax and run it.另外,我有 java 11,但我只能在 IntelliJ 中选择最多 10 级的项目语言级别,但我可以使用“var”语法并运行它。 IntelliJ info:智能信息:

EDIT: Apparently intellij IDEA 1.x does not support java 11 I have downloaded the recent version and currently trying to redo the whole process编辑:显然 intellij IDEA 1.x 不支持 java 11 我已经下载了最新版本,目前正在尝试重做整个过程

FINAL EDIT: I have solved the problem by using java 8 on intelliJ IDEA 3.x and followed this guide .最终编辑:我通过在 intelliJ IDEA 3.x 上使用 java 8 解决了这个问题,并遵循了本指南 Thank you hce !谢谢HCE

主意

Information:Java FX Packager: [C:/Program Files/Java/jdk-11.0.2\\bin\\java, -Dant.home=D:\\Programs\\IntelliJ IDEA 2018.1.5\\lib\\ant, -classpath, D:\\Programs\\IntelliJ IDEA 2018.1.5\\lib\\ant/lib/ant.jar;D:\\Programs\\IntelliJ IDEA 2018.1.5\\lib\\ant/lib/ant-launcher.jar;C:/Program Files/Java/jdk-11.0.2/lib/ant-javafx.jar;C:/Program Files/Java/jdk-11.0.2/jre/lib/jfxrt.jar, org.apache.tools.ant.launch.Launcher, -f, C:\\Users\\HP.IntelliJIdea2018.1\\system\\compile-server\\luckypick-m_8a6db982_temp_\\build.xml] Information:Java FX Packager: Buildfile: C:\\Users\\HP.IntelliJIdea2018.1\\system\\compile-server\\luckypick-m_8a6db982_temp_\\build.xml Information:Java FX Packager: [taskdef] Could not load definitions from resource com/sun/javafx/tools/ant/antlib.xml.信息:Java FX Packager: [C:/Program Files/Java/jdk-11.0.2\\bin\\java, -Dant.home=D:\\Programs\\IntelliJ IDEA 2018.1.5\\lib\\ant, -classpath, D: \\Programs\\IntelliJ IDEA 2018.1.5\\lib\\ant/lib/ant.jar;D:\\Programs\\IntelliJ IDEA 2018.1.5\\lib\\ant/lib/ant-launcher.jar;C:/Program Files/Java/ jdk-11.0.2/lib/ant-javafx.jar;C:/Program Files/Java/jdk-11.0.2/jre/lib/jfxrt.jar, org.apache.tools.ant.launch.Launcher, -f , C:\\Users\\HP.IntelliJIdea2018.1\\system\\compile-server\\luckypick-m_8a6db982_temp_\\build.xml] 信息:Java FX Packager: Buildfile: C:\\Users\\HP.IntelliJIdea2018.1\\system\\compile-server \\luckypick-m_8a6db982_temp_\\build.xml 信息:Java FX 打包程序:[taskdef] 无法从资源 com/sun/javafx/tools/ant/antlib.xml 加载定义。 It could not be found.无法找到。 Information:Java FX Packager: Information:Java FX Packager: build artifact: Information:27.01.2019 15:09 - Compilation completed with 2 errors and 0 warnings in 8 s 226 ms Error:Java FX Packager: BUILD FAILED C:\\Users\\HP.IntelliJIdea2018.1\\system\\compile-server\\luckypick-m_8a6db982_temp_\\build.xml:3: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:fileset Cause: The name is undefined.信息:Java FX Packager:信息:Java FX Packager:构建工件:信息:27.01.2019 15:09 - 编译完成,在 8 秒 226 毫秒内出现 2 个错误和 0 个警告错误:Java FX Packager:构建失败 C:\\Users\\ HP.IntelliJIdea2018.1\\system\\compile-server\\luckypick-m_8a6db982_temp_\\build.xml:3:问题:无法创建任务或键入 javafx:com.sun.javafx.tools.ant:fileset 原因:名称未定义。 Action: Check the spelling.行动:检查拼写。 Action: Check that any custom tasks/types have been declared.行动:检查是否已声明任何自定义任务/类型。 Action: Check that any / declarations have taken place.行动:检查任何/声明已经发生。 No types or tasks have been defined in this namespace yet Total time: 0 seconds Error:Java FX Packager: fx:deploy task has failed.尚未在此命名空间中定义任何类型或任务总时间:0 秒错误:Java FX Packager:fx:deploy 任务失败。

Here is how my project directory looks and which files it has.这是我的项目目录的外观以及它包含哪些文件。

目录

Here's luckypick.properties这是luckypick.properties

path.variable.kotl\u0131n_bundled=D\:\\Programs\\IntelliJ IDEA 2018.1.5\\plugins\\Kotlin\\kotlinc
path.variable.maven_repos\u0131tory=C\:\\Users\\HP\\.m2\\repository
jdk.home.11=C\:/Program Files/Java/jdk-11.0.2
idea.home=D\:/Programs/IntelliJ IDEA 2018.1.5
javafx.home=C\:/Users/HP/Documents/javafx-sdk-11.0.2
javac2.instrumentation.includeJavaRuntime=false

Here's luckypick.xml这是luckypick.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="luckypick" default="all">


    <property file="luckypick.properties"/>
    <!-- Uncomment the following property if no tests compilation is needed -->
    <!--
    <property name="skip.tests" value="true"/>
     -->

    <!-- Compiler options -->

    <property name="compiler.debug" value="on"/>
    <property name="compiler.generate.no.warnings" value="off"/>
    <property name="compiler.args" value=""/>
    <property name="compiler.max.memory" value="700m"/>
    <patternset id="ignored.files">
        <exclude name="**/*.hprof/**"/>
        <exclude name="**/*.pyc/**"/>
        <exclude name="**/*.pyo/**"/>
        <exclude name="**/*.rbc/**"/>
        <exclude name="**/*.yarb/**"/>
        <exclude name="**/*~/**"/>
        <exclude name="**/.DS_Store/**"/>
        <exclude name="**/.git/**"/>
        <exclude name="**/.hg/**"/>
        <exclude name="**/.svn/**"/>
        <exclude name="**/CVS/**"/>
        <exclude name="**/__pycache__/**"/>
        <exclude name="**/_svn/**"/>
        <exclude name="**/vssver.scc/**"/>
        <exclude name="**/vssver2.scc/**"/>
    </patternset>
    <patternset id="library.patterns">
        <include name="*.egg"/>
        <include name="*.jar"/>
        <include name="*.ear"/>
        <include name="*.swc"/>
        <include name="*.war"/>
        <include name="*.zip"/>
        <include name="*.ane"/>
    </patternset>
    <patternset id="compiler.resources">
        <exclude name="**/?*.java"/>
        <exclude name="**/?*.form"/>
        <exclude name="**/?*.class"/>
        <exclude name="**/?*.groovy"/>
        <exclude name="**/?*.scala"/>
        <exclude name="**/?*.flex"/>
        <exclude name="**/?*.kt"/>
        <exclude name="**/?*.clj"/>
    </patternset>

    <!-- JDK definitions -->

    <property name="jdk.bin.11" value="${jdk.home.11}/bin"/>
    <path id="jdk.classpath.11">
        <fileset dir="${jdk.home.11}">
            <include name="/legal/java.base"/>
            <include name="/legal/java.compiler"/>
            <include name="/legal/java.datatransfer"/>
            <include name="/legal/java.desktop"/>
            <include name="/legal/java.instrument"/>
            <include name="/legal/java.logging"/>
            <include name="/legal/java.management"/>
            <include name="/legal/java.management.rmi"/>
            <include name="/legal/java.naming"/>
            <include name="/legal/java.net.http"/>
            <include name="/legal/java.prefs"/>
            <include name="/legal/java.rmi"/>
            <include name="/legal/java.scripting"/>
            <include name="/legal/java.se"/>
            <include name="/legal/java.security.jgss"/>
            <include name="/legal/java.security.sasl"/>
            <include name="/legal/java.smartcardio"/>
            <include name="/legal/java.sql"/>
            <include name="/legal/java.sql.rowset"/>
            <include name="/legal/java.transaction.xa"/>
            <include name="/legal/java.xml"/>
            <include name="/legal/java.xml.crypto"/>
            <include name="/legal/jdk.accessibility"/>
            <include name="/legal/jdk.aot"/>
            <include name="/legal/jdk.attach"/>
            <include name="/legal/jdk.charsets"/>
            <include name="/legal/jdk.compiler"/>
            <include name="/legal/jdk.crypto.cryptoki"/>
            <include name="/legal/jdk.crypto.ec"/>
            <include name="/legal/jdk.crypto.mscapi"/>
            <include name="/legal/jdk.dynalink"/>
            <include name="/legal/jdk.editpad"/>
            <include name="/legal/jdk.hotspot.agent"/>
            <include name="/legal/jdk.httpserver"/>
            <include name="/legal/jdk.internal.ed"/>
            <include name="/legal/jdk.internal.jvmstat"/>
            <include name="/legal/jdk.internal.le"/>
            <include name="/legal/jdk.internal.opt"/>
            <include name="/legal/jdk.internal.vm.ci"/>
            <include name="/legal/jdk.internal.vm.compiler"/>
            <include name="/legal/jdk.internal.vm.compiler.management"/>
            <include name="/legal/jdk.jartool"/>
            <include name="/legal/jdk.javadoc"/>
            <include name="/legal/jdk.jcmd"/>
            <include name="/legal/jdk.jconsole"/>
            <include name="/legal/jdk.jdeps"/>
            <include name="/legal/jdk.jdi"/>
            <include name="/legal/jdk.jdwp.agent"/>
            <include name="/legal/jdk.jfr"/>
            <include name="/legal/jdk.jlink"/>
            <include name="/legal/jdk.jshell"/>
            <include name="/legal/jdk.jsobject"/>
            <include name="/legal/jdk.jstatd"/>
            <include name="/legal/jdk.localedata"/>
            <include name="/legal/jdk.management"/>
            <include name="/legal/jdk.management.agent"/>
            <include name="/legal/jdk.management.jfr"/>
            <include name="/legal/jdk.naming.dns"/>
            <include name="/legal/jdk.naming.rmi"/>
            <include name="/legal/jdk.net"/>
            <include name="/legal/jdk.pack"/>
            <include name="/legal/jdk.rmic"/>
            <include name="/legal/jdk.scripting.nashorn"/>
            <include name="/legal/jdk.scripting.nashorn.shell"/>
            <include name="/legal/jdk.sctp"/>
            <include name="/legal/jdk.security.auth"/>
            <include name="/legal/jdk.security.jgss"/>
            <include name="/legal/jdk.unsupported"/>
            <include name="/legal/jdk.unsupported.desktop"/>
            <include name="/legal/jdk.xml.dom"/>
            <include name="/legal/jdk.zipfs"/>
        </fileset>
    </path>

    <property name="project.jdk.home" value="${jdk.home.11}"/>
    <property name="project.jdk.bin" value="${jdk.bin.11}"/>
    <property name="project.jdk.classpath" value="jdk.classpath.11"/>


    <!-- Project Libraries -->

    <path id="library.javafx-swt.classpath">
        <pathelement location="${javafx.home}/lib/javafx-swt.jar"/>
        <pathelement location="${javafx.home}/lib/javafx.base.jar"/>
        <pathelement location="${javafx.home}/lib/javafx.controls.jar"/>
        <pathelement location="${javafx.home}/lib/javafx.fxml.jar"/>
        <pathelement location="${javafx.home}/lib/javafx.graphics.jar"/>
        <pathelement location="${javafx.home}/lib/javafx.media.jar"/>
        <pathelement location="${javafx.home}/lib/javafx.swing.jar"/>
        <pathelement location="${javafx.home}/lib/javafx.web.jar"/>
    </path>


    <!-- Global Libraries -->
    <!-- Register Custom Compiler Taskdefs -->
    <property name="javac2.home" value="${idea.home}/lib"/>
    <path id="javac2.classpath">
        <fileset dir="${javac2.home}">
            <include name="javac2.jar"/>
            <include name="jdom.jar"/>
            <include name="asm-all*.jar"/>
            <include name="jgoodies-forms.jar"/>
        </fileset>
    </path>
    <target name="register.custom.compilers">
        <taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
        <taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions"
                 classpathref="javac2.classpath"/>
    </target>

    <!-- Modules -->


    <!-- Module LuckyPick -->

    <dirname property="module.luckypick.basedir" file="${ant.file}"/>


    <property name="module.jdk.home.luckypick" value="${project.jdk.home}"/>
    <property name="module.jdk.bin.luckypick" value="${project.jdk.bin}"/>
    <property name="module.jdk.classpath.luckypick" value="${project.jdk.classpath}"/>

    <property name="compiler.args.luckypick" value="-encoding UTF-8 -source 10 -target 10 ${compiler.args}"/>

    <property name="luckypick.output.dir" value="${module.luckypick.basedir}/out/production/LuckyPick"/>
    <property name="luckypick.testoutput.dir" value="${module.luckypick.basedir}/out/test/LuckyPick"/>

    <path id="luckypick.module.bootclasspath">
        <!-- Paths to be included in compilation bootclasspath -->
    </path>

    <path id="luckypick.module.production.classpath">
        <path refid="${module.jdk.classpath.luckypick}"/>
        <path refid="library.javafx-swt.classpath"/>
    </path>

    <path id="luckypick.runtime.production.module.classpath">
        <pathelement location="${luckypick.output.dir}"/>
        <path refid="library.javafx-swt.classpath"/>
    </path>

    <path id="luckypick.module.classpath">
        <path refid="${module.jdk.classpath.luckypick}"/>
        <pathelement location="${luckypick.output.dir}"/>
        <path refid="library.javafx-swt.classpath"/>
    </path>

    <path id="luckypick.runtime.module.classpath">
        <pathelement location="${luckypick.testoutput.dir}"/>
        <pathelement location="${luckypick.output.dir}"/>
        <path refid="library.javafx-swt.classpath"/>
    </path>


    <patternset id="excluded.from.module.luckypick">
        <patternset refid="ignored.files"/>
    </patternset>

    <patternset id="excluded.from.compilation.luckypick">
        <patternset refid="excluded.from.module.luckypick"/>
    </patternset>

    <path id="luckypick.module.sourcepath">
        <dirset dir="${module.luckypick.basedir}">
            <include name="src"/>
            <include name="res"/>
        </dirset>
    </path>


    <target name="compile.module.luckypick" depends="compile.module.luckypick.production,compile.module.luckypick.tests"
            description="Compile module LuckyPick"/>

    <target name="compile.module.luckypick.production" depends="register.custom.compilers"
            description="Compile module LuckyPick; production classes">
        <mkdir dir="${luckypick.output.dir}"/>
        <javac2 destdir="${luckypick.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}"
                memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.luckypick}/javac">
            <compilerarg line="${compiler.args.luckypick}"/>
            <bootclasspath refid="luckypick.module.bootclasspath"/>
            <classpath refid="luckypick.module.production.classpath"/>
            <src refid="luckypick.module.sourcepath"/>
            <patternset refid="excluded.from.compilation.luckypick"/>
        </javac2>

        <copy todir="${luckypick.output.dir}">
            <fileset dir="${module.luckypick.basedir}/src">
                <patternset refid="compiler.resources"/>
                <type type="file"/>
            </fileset>
            <fileset dir="${module.luckypick.basedir}/res">
                <patternset refid="compiler.resources"/>
                <type type="file"/>
            </fileset>
        </copy>
    </target>

    <target name="compile.module.luckypick.tests"
            depends="register.custom.compilers,compile.module.luckypick.production"
            description="compile module LuckyPick; test classes" unless="skip.tests"/>

    <target name="clean.module.luckypick" description="cleanup module">
        <delete dir="${luckypick.output.dir}"/>
        <delete dir="${luckypick.testoutput.dir}"/>
    </target>

    <target name="init" description="Build initialization">
        <!-- Perform any build initialization in this target -->
    </target>

    <target name="clean" depends="clean.module.luckypick" description="cleanup all"/>

    <target name="build.modules" depends="init, clean, compile.module.luckypick" description="build all modules"/>

    <target name="all" depends="build.modules" description="build all"/>
</project>

ant build output:蚂蚁构建输出:

蚂蚁构建输出

Pls.请。 try the following:尝试以下操作:

<project name="luckypick" default="all" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
...
<target name="all" depends="build.modules" description="build all">
   <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
            uri="javafx:com.sun.javafx.tools.ant"
            classpath=".:path/to/sdk/lib/ant-javafx.jar"/>    
</target>

Also try to use JDK 8. The Packager is removed from Oracle JDK 11. See here for Details也尝试使用 JDK 8。从 Oracle JDK 11 中删除了 Packager。有关详细信息,请参见此处

A packaging tool can also help fill gaps left by other technologies such as Java Web Start, which was removed from Oracle's JDK 11, and pack200, which was deprecated in JDK 11 for removal in a future release.打包工具还可以帮助填补其他技术留下的空白,例如从 Oracle 的 JDK 11 中删除的 Java Web Start 和在 JDK 11 中已弃用以在未来版本中删除的 pack200。 Developers can use jlink to strip the JDK down to the minimal set of modules that are needed, and then use the packaging tool to produce a compressed, installable image that can be deployed to target machines.开发人员可以使用 jlink 将 JDK 剥离为所需的最小模块集,然后使用打包工具生成可部署到目标机器的压缩、可安装映像。

To address these requirements previously, a packaging tool called javapackager was distributed with Oracle's JDK 8. However, it was removed from Oracle's JDK 11 in connection with the removal of JavaFX.以前为了满足这些要求,Oracle 的 JDK 8 随附了一个名为 javapackager 的打包工具。但是,随着 JavaFX 的删除,它已从 Oracle 的 JDK 11 中删除。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法构建JavaFX 2.1.0示例应用程序 - DataApp - 无法创建任务或输入javafx:com.sun.javafx.tools.ant:application - cannot build JavaFX 2.1.0 sample application - DataApp - failed to create task or type javafx:com.sun.javafx.tools.ant:application 在 NetBeans 9 和 11 中打包为 DMG 图像,JDK 11 返回“typedef class com.sun.javafx.tools.ant.FXJar cannot be found using the..” - Package as DMG Image in NetBeans 9 & 11, JDK 11 returns "typedef class com.sun.javafx.tools.ant.FXJar cannot be found using the.." 是com.sun.javafx.robot.FXRobot专有的 - Is com.sun.javafx.robot.FXRobot proprietary Java 9中的com.sun.javafx.collections - com.sun.javafx.collections in Java 9 无法访问类 com.sun.javafx.util.Utils(在模块 javafx.graphics 中)-JavaFX 和 Eclipse - Cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) - JavaFX & Eclipse Javafx-任务&#39;:run&#39;的执行失败 - Javafx - Execution failed for task ':run' 超类访问检查失败:类 com.sun.javafx.sg.prism.web.NGWebView - superclass access check failed: class com.sun.javafx.sg.prism.web.NGWebView 由于“GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline”,JavaFX 程序无法启动 - JavaFX program does not start due to "GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline" JavaFX任务结束和JavaFX线程化 - JavaFX Task ending and JavaFX threading AutoCompletionBinding 无法访问类 com.sun.javafx.event.EventHandlerManager - AutoCompletionBinding cannot access class com.sun.javafx.event.EventHandlerManager
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM