Search code examples
flashantexecblazeds

BlazeDS Generated Files Causing Flex Compiler to Fail


I have never worked with Flash/BlazeDS or Ant before, so sorry if this is simplistic.

I have a project that I need to develop some Java code for. The project is using Flash and BlazeDS. For the initial build of the project, an Ant script is run that eventually runs what I believe is the Flex compiler (the sdk attribute points to a FlashBuilder 4 sdk/4.1.0 directory).

<exec executable='"@{sdk}/bin/mxmlc.exe"' failonerror="true">
    //A bunch of <arg> tags
</exec>

This initially ran without error.

I finished the project setup, which included connecting to BlazeDS in FlashBuilder. During the setup, some service and valueObject classes were updated (all beginning with underscores). I believe these are just the generated files BlazeDS makes.

Everything works fine at this point. However, if I try to run the Ant build script again, the <exec> fails, with the following output (I blacked out company info).

Build error

From what I read online, the error code from Ant <exec> is OS dependent. I am on a Windows 7 machine, and I found the supposed error codes. However, error 35 does not exist.

Does any one have an idea of what the error is and how to fix it? I have a semi-guess that maybe the issue lies in that I am using FlashBuilder 4.5 and the generated BlazeDS files are being made different. I've tried updating the SDK location to point to 4.5.0 and 4.5.1 folders, but no luck.


Solution

    1. Why not use FlexTask (adobe provides an Ant task to wrap mxmlc, compc and asdoc tools)? I can understand it when contributed libraries aren't warmly welcomed, but this one is kind of a standard for AS3 builds.

    2. The error code is returned from mxmlc, which, as you rightly noted is the Adobe Flex compiler. However, the return code from compiler is meaningless. You need the actual compiler output (it prints the error kind and the location). Unless you can run the compiler normally (in the way that the output it produces is not ignored), you may spend days trying to find an error :) If you insist on using exec task, then exec can redirect the output of a program to either property or file. Maybe redirect it to property and then echo out the content of the property?

    3. Why do you need to generate AS3 code using Blaze? It has a very poor code generator. Writing one yourself may actually be a better move.

    4. Blaze doesn't generate classes with underscores, unless the original Java classes have underscores (rather unusual). The classes with underscores are more common in the code generated by Flex compiler for things like embedded assets, inline MXML components, some other code generated by Flash Builder etc.