eclipse 无法从资源 flexTasks.tasks 加载定义。找不到

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1615879/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:04:51  来源:igfitidea点击:

Could not load definitions from resource flexTasks.tasks. It could not be found

apache-flexeclipseantflex3

提问by Adam Tuttle

I'm attempting to compile a Flex application from an ANT script, inside of Eclipse (CFBuilder, based on Eclipse), and I've run into this error:

我正在尝试从 Eclipse 内部的 ANT 脚本(CFBuilder,基于 Eclipse)编译 Flex 应用程序,但我遇到了这个错误:

Could not load definitions from resource flexTasks.tasks. It could not be found.

无法从资源 flexTasks.tasks 加载定义。无法找到。

I haven't been able to find anything that gives directions on where this file (flexTasks.tasks) should be copied to, if it's needed at all. Some places indicate that it should be part of the flexTasks.jar file. I've tried two different things:

如果根本需要,我一直无法找到任何可以说明此文件 (flexTasks.tasks) 应复制到何处的说明。有些地方指出它应该是 flexTasks.jar 文件的一部分。我尝试了两种不同的方法:

  • Copy the jar file into the ant/plugins/lib folder (and restart my CF Builder instance)
  • Specify the path to the jar in the classpathattribute, as suggested by the comment on this page
  • 将 jar 文件复制到 ant/plugins/lib 文件夹中(并重新启动我的 CF Builder 实例)
  • classpath按照本页注释的建议,在属性中指定 jar 的路径

Neither helps me get past this error.

两者都没有帮助我克服这个错误。

Here's my build script, for reference:

这是我的构建脚本,供参考:

<project name="Tagging" default="compile-tagging" basedir=".">

    <!-- setup flex compilation capability -->
    <taskdef resource="flexTasks.tasks" />

    <property name="flex.src" value="./src" />
    <property name="flex.bin" value="./bin"/>

    <target name="compile-tagging">
        <mxmlc 
            file="${flex.src}/main.mxml"
            output="${flex.bin}/main.swf" 
            keep-generated-actionscript="true">
                <source-path path-element="${FLEX_HOME}/frameworks" />
        </mxmlc>
    </target>

</project>

采纳答案by Adam Tuttle

While not ideal, this code is working for me at the moment:

虽然不理想,但这段代码目前对我有用:

<project name="IOLTagging" default="go" basedir=".">

    <!-- setup flex compilation capability -->
    <property name="FLEX_HOME" value="C:/program files (x86)/Adobe/Adobe Flash Builder Beta 2/sdks/3.4.1/" />
    <taskdef name="mxmlc" classname="flex.ant.MxmlcTask" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
    <taskdef name="html-wrapper" classname="flex.ant.HtmlWrapperTask" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

    <property name="flex.src" value="./src" />
    <property name="flex.bin" value="./bin"/>
    <property name="swf.name" value="main" />

    <target name="go" depends="compile-flex" />

    <target name="compile-flex">
        <mxmlc 
            file="${flex.src}/main.mxml"
            output="${flex.bin}/${swf.name}.swf"
            debug="false" 
            keep-generated-actionscript="false">
                <source-path path-element="${FLEX_HOME}/frameworks" />
                <compiler.library-path dir="${basedir}/libs" append="true">
                    <include name="*.swc" />
                </compiler.library-path>
        </mxmlc>
    </target>
</project>

回答by marc esher

Adam, I believe you need to tell taskdef where to look for the file. try keeping flextasks.jar in the same directory as your ant file (for now... you can move it later after you get it working).

亚当,我相信您需要告诉 taskdef 在哪里查找文件。尝试将 flextasks.jar 保存在与您的 ant 文件相同的目录中(现在……您可以在它工作后稍后移动它)。

then, you can do something like this:

然后,您可以执行以下操作:

<taskdef name="mxmlc" classname="WhateverTheTaskIsNamed" classpath="flexTAsks.jar" />

回答by weekens

I had the same problem, and the reason was in lack of permissions to acces $FLEX_HOME/ant.

我遇到了同样的问题,原因是缺乏访问 $FLEX_HOME/ant 的权限。

回答by Steve D.

You can also put the flexTasks.jar in ~/.ant/lib directory

你也可以把 flexTasks.jar 放在 ~/.ant/lib 目录下

If you run ant -diagnostics you should see the jar in USER_HOME/.ant/lib jar listing

如果您运行 ant -diagnostics,您应该会在 USER_HOME/.ant/lib jar 列表中看到该 jar

回答by leqiang

I think you should have solved this problem. just trying flexmonkey today and also got the same problem.

我想你应该已经解决了这个问题。今天刚尝试 flexmonkey 也遇到了同样的问题。

"Could not load definitions from resource flexTasks.tasks. It could not be found." solution is to make sure the flexTasks.jar is included in the dir lib of your project workplace. when I copied flexTasks.jar from flashbuild folder \ant\lib and built it again. the problem is fixed.

“无法从资源 flexTasks.tasks 加载定义。找不到它。” 解决方案是确保 flexTasks.jar 包含在项目工作区的目录库中。当我从 flashbuild 文件夹 \ant\lib 复制 flexTasks.jar 并再次构建它时。问题已解决。