Embrace the timeline….

On creating rich, flashy and immersive advertising experiences online by Owen van Dijk

Odd bug in mxmlc compiler and setting up a build environment with Ant

leave a comment »

I ran into an odd bug with the mxmlc compiler while i was setting up a build environment for our project. It turns out the compiler fails if your project does the following:

  • Your ‘main’ class ( think of the Document class used in Blaze/Flash 9 ) sits in a package other then the default ( ie. com.foo.bar )
  • Your application classes are in a different folder then the Build file ( ie your classes are in a subdirectory called ‘src’ while the Build file sits in the root of your project
  • Your project directory sits on a disk that starts with a capital ( ie D:\eclipse instead of d:\eclipse )

The compiler expects a lower case ( ie d:\eclipse\workspace\…. instead of D:\eclipse\workspace\… ) for the -source-file-specs and -file-specs arguments. I solved the problem by setting an Environment variable called eclipseworkspace that i set to d:\eclipse\workspace and then using the following code:


<property environment="env">
<property value="${env.eclipseworkspace}\project\src" name="mxmlc.start">

<target name="compilewithmxmlc">
        <exec failonerror="true" executable="${mxmlc.exe}">
            <arg line="-source-path ${mxmlc.start}">
            <arg line="-file-specs ${mxmlc.start}\\com\\foo\\bar\\Application.as">
            <arg line="-default-size 960 700"/>
            <arg line="-default-frame-rate 31"/>
            <arg line="-default-background-color 0xFFFFFF"/>


The compiler now warns me that my source-path is the same as my package but it does compile the code. If i have more time i’ll fix the warnings too but for now this works for me. Normally you let FlexBuilder do all the plumbing code but i wanted my Ant buildfile run standalone ( it checks out the code from SVN, runs some tests, compiles the code, sets up documentation and makes a build.zip ) in a continuous integration process. The error message i got was ‘Error: A file found in a source-path must have the same package structure’ (if you happen to Google on the error code). Good luck! 🙂

Link: [Flashcoders] as3: weird package problem.


Written by ohwhen

October 25, 2006 at 3:59 pm

Posted in Web/Tech

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: