Compiling BlazeDS source code using Ant

Compiling the BlazeDS source code takes a lot more than one might expect. A mix of bad instructions from Adobe and general craziness that is Windows XP is to blame.

The problem was that ‘ant’ was failing during the building BlazeDS and giving errors like the following when I ran ‘ant main’ like the instructions told me to do:

  • build.xml:69: The following error occurred while executing this line: modules\common\build.xml:100: Unable to rename old file (flex-messaging-common.jar) to temporary file

I had more luck if I manually called each of the ant tasks (ie. ant clean; ant sdk; ant common; ant common; ant core; ant core; ant proxy; ant remoting; ant opt; ant apps; ant createMMSFile). Don’t ask me why I had to run ‘ant common’ and ‘ant core’ twice, it wouldn’t work otherwise. But when I finally ran ‘ant package’ at the end, to create the ‘blazeds.war’ file I need, I got the following error:

  • mxmlc task failed

The solution to the first problem involves manually calling each ant task. The solution to the second problem involves editing the ‘ant.bat’ file and increasing the default memory limit. The following is a guide to how I got a working build.

1)     Download the source zip file from the BlazeDS website (

2)     Open up the ‘readme.txt’ and follow the first two requirement sections, but do NOT run ‘ant’ yet!

  1. Basically, download ant if you don’t have it, download the necessary JUNIT and ant-collab jars, and set up the environment variables

3)     Insert the following line at the top of your ‘ant.bat’ file:

  1. set ANT_OPTS=-XX:MaxPermSize=256m

4)     Run the following sequence of ‘ant’ build commands

  1. ant clean
  2. ant sdk
  3. ant common (twice if it fails the first time)
  4. ant core (twice if it fails the first time)
  5. ant proxy
  6. ant remoting
  7. ant opt
  8. ant apps
  9. ant createMMSFile
  10. ant package

5)     Now you can use the newly built ‘blazeds.war’ ‘ds-console.war’ and ‘samples.war’ in the ‘dist’ directory of your BlazeDS source root directory.

For more information:


6 thoughts on “Compiling BlazeDS source code using Ant

  1. Pingback: Compiling BlazeDS source code using Ant « rishi / software | Flex learner

  2. Hi, I’ve found this guide extremely useful! I’m having just one problem though. On the last step ‘ant package’, it gets part of the way through and then it fails because it can’t find various charting classes (LineChart, LineSeries, etc). Any insight into this?

  3. Sorry, my previous post was incorrect. When I run ‘ant package’ it ends up telling me that it can’t find tools.ant.MergeXML.

    I cannot find this class anywhere on the internet 🙂

    • Hi Ben –

      Thanks for the comment! Do you have the the latest version of the ant-contrib lib referenced? Seems like that might be an issue…

      The BlazeDS readme file says the following is required (latest I compiled was blazeds 4.0.4619):
      BlazeDS build script requires that the following products are installed.
      – ANT 1.7.0
      – ANT-CONTRIB-1.0b2
      – Sun JDK 5
      – JUnit (required in ANT_HOME/lib for “unit” target)

      BlazeDS build script requires that the following environment variable are set properly.
      – JAVA_HOME
      – ANT_HOME
      – JAVA_HOME\bin and ANT_HOME\bin must be on the path.

  4. Thank you for the quick response! It turns out that I had ant-contrib 1.0b3, and the build.xml file was referencing 1.0b2.

    I had hoped this would fix it, but I still get the same error. I tried referencing 1.0b3 instead but it didn’t work, and I downloaded 1.0b2 and that still didn’t work. I also referenced these jars using an absolute path. Any other advice would be much appreciated 🙂

    • Any luck with a solution? Where did you place your ant-contrib jar file? Try placing it within ANT_HOME lib directory, that might do the trick.

Leave a Reply

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

You are commenting using your 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