views:

2122

answers:

3

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>
+1  A: 

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" />
marc esher
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
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! :)
Adam Tuttle
+1  A: 

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>
Adam Tuttle
A: 

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

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

leqiang