Akshay
Akshay

Reputation: 1716

Using ANT to build swc, cannot find catalog.xml

I'm trying to build an SWC (in Flex 4.6) using ANT. This is what my build.xml looks like right now

<?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>

And flexTasks.tasks looks like this

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

When I run the build, I get the this error

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

It appears that compc is trying to read the flexTasks jar as an SWC. What's going on here?

Upvotes: 1

Views: 1217

Answers (1)

Timofei Davydik
Timofei Davydik

Reputation: 7303

Seems, that you jar library with tasks definitions is in the libs dir as all the swc files, compiler tries to use it as an swc library. And since jar and swc are both archives, compiler extracts them and tries to find catalog.xml inside, but jar is not flash library and does not contain it. I suggest you to put jar to some another location and leave only swc files inside lib. Or specify swc pattern

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

Upvotes: 1

Related Questions