无法构建 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

查看:28
本文介绍了无法构建 JavaFX 2.1.0 示例应用程序 - DataApp - 未能创建任务或键入 javafx:com.sun.javafx.tools.ant:application的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从可从官方 JafaFX 下载页面下载的 JavaFX 2.1.0 示例应用程序包构建 DataApp 示例应用程序:
http://www.oracle.com/technetwork/java/javafx/downloads/index.html

I am trying to build the DataApp sample application from the JavaFX 2.1.0 sample application pack downloadable from the official JafaFX downloads page:
http://www.oracle.com/technetwork/java/javafx/downloads/index.html

我使用 Netbeans 7.1.2、JDK6 和 JavaFX 2.1.0 for JDK6.

I am using Netbeans 7.1.2, JDK6 and JavaFX 2.1.0 for JDK6.

在 NetBeans 中,当我右键单击 DataApp 服务器并从上下文菜单中选择运行时,我得到以下输出:

In NetBeans, when I right-click on the DataApp server and select Run from the context menu, I get the following output:

check-mysql-drivers-installed:
init:
deps-module-jar:
DataAppClient.init:
Deleting: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\built-jar.properties
DataAppClient.deps-jar:
Updating property file: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\built-jar.properties
DataAppLibrary.init:
DataAppLibrary.deps-jar:
Updating property file: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\built-jar.properties
DataAppLibrary.compile:
Copy libraries to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppLibrary\dist\lib.
To run this application from the command line without Ant, try:
java -jar "D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppLibrary\dist\DataAppLibrary.jar"
DataAppLibrary.jar:
Duplicated project name in import. Project jfx-impl defined first in D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\nbproject\jfx-impl.xml and again in D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\nbproject\jfx-impl.xml
DataAppPreloader.init:
DataAppPreloader.deps-jar:
Updating property file: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\built-jar.properties
DataAppPreloader.compile:
Copying 1 file to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\build
Copy libraries to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\dist\lib.
To run this application from the command line without Ant, try:
C:\jdk1.6.0_30/bin/java -jar "D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\dist\DataAppPreloader.jar"
Deleting directory D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\dist\lib
Detected JavaFX Ant API version 1.1
DataAppPreloader.jfx-deployment:
DataAppPreloader.jar:
DataAppClient.compile:
Copying 27 files to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib
Moving 1 file to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\DataAppLibrary.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jackson-core-asl-1.7.1.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jackson-jaxrs-1.7.1.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jackson-mapper-asl-1.7.1.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jackson-xc-1.7.1.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jersey-client-1.8.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jersey-core-1.8.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jersey-json-1.8.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Deleting directory D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib
D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppServer\nbproject\build-impl.xml:559: The following error occurred while executing this line:
D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build.xml:48: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:application
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
BUILD FAILED (total time: 6 seconds)

有人知道这个错误吗?

会不会和 Ant 有某种关系?

Could it be somehow related to Ant ?

以下几行是什么意思?

The following error occurred while executing this line:
D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build.xml:48: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:application
Cause: The name is undefined.

谢谢!

更新:显然,该问题是通过手动修改位于 DataAppClient 项目根目录中的 Ant build.xml 文件解决的.
我在 -post-jar 目标定义的开头添加了一个 taskdef 标记,错误消失了:

Update: Aparently the problem is solved by manually modifying the Ant build.xml file located in the DataAppClient project root.
I added a taskdef tag at the beginning of the -post-jar target definition and the error was gone:

...

<target name="-post-jar" depends="-init-javafx, -jfx-copylibs">

    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
             uri="javafx:com.sun.javafx.tools.ant"
             classpath="d:\Soft\javafx_sdk_2.1\lib\ant-javafx.jar" />

    <!-- Move preloader out of libs -->
    <move file="${dist.dir}/lib/DataAppPreloader.jar" todir="${dist.dir}"/>

...

这可能是此示例应用程序的正式发布中的错误,还是我的设置有问题?

Can this be an error in the official release of this sample application, or something is wrong with my setup ?

推荐答案

显然问题是通过手动修改位于 DataAppClient 项目根目录中的 Ant build.xml 文件解决的.
我在 -post-jar 目标定义的开头添加了一个 taskdef 标记,错误消失了:

Aparently the problem is solved by manually modifying the Ant build.xml file located in the DataAppClient project root.
I added a taskdef tag at the beginning of the -post-jar target definition and the error was gone:

...

<target name="-post-jar" depends="-init-javafx, -jfx-copylibs">

    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
             uri="javafx:com.sun.javafx.tools.ant"
             classpath="d:\Soft\javafx_sdk_2.1\lib\ant-javafx.jar" />

    <!-- Move preloader out of libs -->
    <move file="${dist.dir}/lib/DataAppPreloader.jar" todir="${dist.dir}"/>

...

这篇关于无法构建 JavaFX 2.1.0 示例应用程序 - DataApp - 未能创建任务或键入 javafx:com.sun.javafx.tools.ant:application的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆