错误提示为:
FLEX_HOME must be set to use the Flex Ant Tasks
或者为
[taskdef] Could not load definitions from resource flexTasks.tasks. It could not be found.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
或者为:
[taskdef] Could not load definitions from resource flexTasks.tasks. It could not be found.
出现这个问题的原因是,使用mxmlc或compc,或其它命令的时候,ant无法定位或识别该命令。解决方法:
在flex sdk文件夹中,有个名为 flexTasks.tasks的文件,它包含以下内容:
mxmlc=flex.ant.MxmlcTask
compc=flex.ant.CompcTask
html-wrapper=flex.ant.HtmlWrapperTask
了解了flexTasks.tasks 这个文件,这下应该略晓得怎么解决了吧?
将flexTasks.jar定义成这样,就可以运行了。
<taskdef name="compc" classname="flex.ant.CompcTask"
classpath="${flexhome}/ant/lib/flexTasks.jar" />
Name:替换为你要使用的命令
Classname :替换成你要使用的命令的类名,和上边一个样的
Classpath : 你自己 flexTasks.jar 放的位置。
给个具体的例子吧:
<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>
转载地址:http://www.51testing.com/?uid-350678-action-viewspace-itemid-808920