2012-10-31 93 views
1

我正在嘗試使用ANT構建SWC(在Flex 4.6中)。這是我的build.xml文件看起來像現在使用ANT構建swc,找不到catalog.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

看來,你jar庫任務的定義是在libs目錄爲所有swc文件,編譯器會嘗試使用它作爲一個swc庫。由於jarswc都是歸檔文件,因此編譯器會提取它們並嘗試在裏面找到catalog.xml,但jar不是flash庫並且不包含它。我建議你把jar放到另一個位置,並且只在文件裏面保留swc文件。或指定swc模式

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