tags:

views:

932

answers:

4

Hi all, I updated a flex application from flex 3.5 to flex 4.0. We are using ant for compiling our project and we have a mxmlc task to handle the flex part. After the upgrade, our mxmlc task broke.

Here is the task definition:

<taskdef resource="flexTasks.tasks">
        <classpath>
            <pathelement path="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
            <fileset dir="${FLEX_HOME}/lib">
                <include name="**/*.jar"/>
            </fileset>
        </classpath> </taskdef>

And here is mxmlc task

<mxmlc file="${src}/Main.mxml" output="${build}/main.swf" debug="true" 
target-player="10" services="../src/main/webapp/WEB-INF/flex/services-config.xml" 
context-root="/" >
            <compiler.library-path dir="${lib}">
                <include name="*.swc"/>
            </compiler.library-path>
            <compiler.library-path dir="${FLEX_HOME}/frameworks/libs">
                <include name="*.swc"/>
            </compiler.library-path>

            <compiler.library-path dir="${FLEX_HOME}/frameworks/libs/player/10.0">
                <include name="*.swc"/>
            </compiler.library-path>

            <compiler.library-path dir="${FLEX_HOME}/frameworks/locale">
                <include name="**/*"/>
            </compiler.library-path>
        </mxmlc>

And we are getting:

The class not found in jar file: mxmlc.jar

I checked the ${FLEX_HOME}/lib folder and I can see the mxmlc.jar file there.

Here is the verbose output of ant:

build.xml:69: The class not found in jar file: mxmlc.jar
    at flex.ant.FlexTask.resolveClass(FlexTask.java:347)
    at flex.ant.FlexTask.executeInProcess(FlexTask.java:273)
    at flex.ant.FlexTask.execute(FlexTask.java:225)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.Main.runBuild(Main.java:758)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

I appreciate your comments for resolving this matter,

Thanks, -A

A: 

Upgrading to ant 1.8 resolved the issue.

Ali
A: 

I traced this problem down to the Adobe SDK zip file leaving the unzip contents with permissions that didn't allow my hudson user to read things. Once I did some chmods to the files and directories in the installed FLEX_HOME, everything worked fine.

Eric Soderberg
A: 

Friend,

Please copy latest flexTask.jar file from your {FLEX HOME}\ant\lib directory and paste into Ant\lib.

Raj.

Raj
A: 

<!-- CHANGE TO YOUR FLEX DIRECTORY //-->
<property name="FLEX_HOME" value="C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.0.0"/>
<property name="APP_ROOT" value="myApp"/>

<taskdef resource="flexTasks.tasks" >
    <classpath> <pathelement path="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
        <pathelement path="${FLEX_HOME}/lib/flexTasks.jar"/> 
        <fileset dir="${FLEX_HOME}/lib"> 
            <include name="**/*.jar"/>
        </fileset> 
    </classpath>
</taskdef>

<target name="main">
    <antcall target="en_US"></antcall>
    <antcall target="ja_JP"></antcall>
</target>
<target name="en_US">
    <mxmlc>
        <locale>en_US</locale>
        <source-path>../locale/{locale}</source-path>
        <include-resource-bundles>calendarsample</include-resource-bundles>
        <include-resource-bundles>elixirsamplebar</include-resource-bundles>
        <include-resource-bundles>p1browzer</include-resource-bundles>
        <include-resource-bundles>security</include-resource-bundles>
        <include-resource-bundles>setupBundle</include-resource-bundles>
        <include-resource-bundles>customerBundle</include-resource-bundles>
        <include-resource-bundles>orderBundle</include-resource-bundles>
        <output>../bin-debug/Resources_en_US.swf</output>
    </mxmlc>
</target>
<target name="ja_JP">
        <mxmlc keep-generated-actionscript="false">
            <locale>ja_JP</locale>
            <source-path>../locale/{locale}</source-path>
            <compiler.library-path dir="${FLEX_HOME}/frameworks" append="false">
                <include name="libs" />
            </compiler.library-path>
            <include-resource-bundles>calendarsample</include-resource-bundles>
            <include-resource-bundles>elixirsamplebar</include-resource-bundles>
            <include-resource-bundles>p1browzer</include-resource-bundles>
            <include-resource-bundles>security</include-resource-bundles>
            <include-resource-bundles>setupBundle</include-resource-bundles>
            <include-resource-bundles>customerBundle</include-resource-bundles>
            <include-resource-bundles>orderBundle</include-resource-bundles>
            <output>../bin-debug/Resources_ja_JP.swf</output>
        </mxmlc>
    </target>

Rajesh Yadav