使用ANT构建swc,找不到catalog.xml

时间:2012-10-31 12:57:14

标签: flex ant

我正在尝试使用ANT构建SWC(在Flex 4.6中)。这就是我的build.xml现在的样子

<?xml version="1.0" encoding="UTF-8"?>
<project name="imanager-framework" basedir=".">

    <property name="src" location="src"/>   
    <property name="dist" location="dist"/> 
    <property name="FLEX_HOME" value="C:/Program Files (x86)/Adobe/Adobe Flash Builder 4.5/sdks/4.6.0"/>        

    <taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasksFlash4.jar"/>

    <target name="clean">       
        <delete dir="${dist}"/>
    </target>

    <target name="compile">
        <mkdir dir="${dist}"/>
        <compc output="${dist}/imanager-framework.swc">
            <source-path path-element="src" />
            <library-path dir="libs" includes="*" />
            <include-sources dir="${src}" includes="*" />           
        </compc>
    </target>

</project>

flexTasks.tasks看起来像这样

mxmlc=flex.ant.MxmlcTask
compc=flex.ant.CompcTask
html-wrapper=flex.ant.HtmlWrapperTask
asdoc=flex.ant.AsDocTask

当我运行构建时,我收到此错误

Buildfile: E:\flexspace\imanager\framework\build.xml
compile:
    [compc] Loading configuration file C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\flex-config.xml
    [compc] Error: unable to load SWC flexTasksFlash4.jar: could not find catalog.xml within the SWC.

BUILD FAILED
E:\flexspace\imanager\framework\build.xml:16: compc task failed

Total time: 639 milliseconds

似乎compc正在尝试将flexTasks jar作为SWC读取。这是怎么回事?

1 个答案:

答案 0 :(得分:1)

似乎,jar具有任务定义的库在libs目录中作为所有swc文件,编译器会尝试将其用作swc库。由于jarswc都是归档,编译器会提取它们并尝试在内部找到catalog.xml,但jar不是flash库而不包含它。我建议你把jar放到另一个位置,只在lib里面留下swc个文件。或者指定swc pattern

<library-path dir="libs" includes="*.swc" />