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

17,017

Solution 1

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>

Solution 2

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

Solution 3

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).

then, you can do something like this:

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

Solution 4

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

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

Share:
17,017
Adam Tuttle
Author by

Adam Tuttle

Geek, Skydiver, Woodworker, Husband, Father. Order of precedence changes at random.

Updated on June 04, 2022

Comments

  • Adam Tuttle
    Adam Tuttle almost 2 years

    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:

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

    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:

    • Copy the jar file into the ant/plugins/lib folder (and restart my CF Builder instance)
    • Specify the path to the jar in the classpath attribute, as suggested by the comment on this page

    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>
    
  • Adam Tuttle
    Adam Tuttle over 14 years
    How do I know what to put as the class name? I tried "mxmlc" but that produces this error: "\build.xml:4: taskdef class mxmlc cannot be found"
  • Adam Tuttle
    Adam Tuttle over 14 years
    I took another stab at it and tried "flex.ant.MxmlcTask" (based on the contents of the jar), which got me farther: "build.xml:16: FLEX_HOME must be set to use the Flex Ant Tasks". I fixed this, and now I can compile. It's not ideal, but it will work for now! :)