Mavenize Your Flex/AIR App

Monday, February 9th, 2009

I recently had a need to create a maven project that could compile my Flex application and package it up as an AIR app. After fighting with Flex-Mojos 2.x, I decided to try out the new 3.0-SNAPSHOT and finally got a successful compile and package. The main project page for Flex-Mojos can be found here.

Anyways here’s my full pom.xml. Make sure to take note of the following:

  • Lines 8-12 : Include a parent POM provided my the flex-mojo’s project. Makes it so that you do not have to include all the flex and air dependencies yourself.
  • Line 18 : Set the package to swf. Hopefully this can be fixed in the future because I’ve seen other posts about how you should be able to put aswf there for an AIR application but that did not work for me.
  • Lines 25-60 : Since the final artifact is a swf, you still need to run the adt command to convert it to an AIR package. I’ve taken this snippet of code from the following blog. Please take a look at that as it explains how this command expects a digital certificate to reside in the classes/cert directory and how the passwords work.
  • Lines 63-87 : New repository url for the flex-mojos project
  • Lines 93-96 : Need to specify where your Flex SDK lives so that the adt.jar can be executed during the package phase.

That should do it. Run mvn package and you should see an .air file in your root project directory. It’s not a perfect solution but at least it works. If you know anything I could change or improve on please let me know.

Bookmark and Share

One Response to “Mavenize Your Flex/AIR App”

  1. Shane wrote:
    February 9th, 2009 at 4:42 pm |

    Nice work! I’ll have to update my CMIS explorer to use Maven now.

Leave a Reply