Despite some fashionable buzz to the contrary, Maven has gained momentum in the market. It has done so by consistently meeting criticism with objective self-evaluation and improvement. I’ve recently been trying to erase one of the main objections (lack of consistent and comprehensive documentation) by working on a Maven book which is still in an early alpha release stage. With the release of Maven 2.0.9 and the new focus on quality, I’m starting to see Maven expand its boundaries beyond the expected Java project. I’ve always known that people were striving to expand Maven beyond Java, but, until now, I haven’t really seen the promise realized. I’m starting with Flex because there is a recent abundance of quality Flex Mojos hosted outside the Apache Maven and Codehaus Mojo projects. Flex and Java seem to have a “special relationship”, and I think it is fitting that Flex is one of the first areas where Maven is starting to expand.
Adobe Flex 3 SDK: Open Source
For general content related to Rich Internet Applications (RIA), you’ll probably want to check out O’Reilly’s InsideRIA.com. I’m approaching Flex more from the perspective of a Java developer…
Here we are, a year after the anouncement of JavaFx, and, from where I sit, the energy is still with Adobe’s Flex and it has gained more momentum with Adobe’s release of Flex 3. Right now, you can download the open source Flex 3 SDK and start compiling and distributing Flex and AIR content without having to pay the piper. The compiler, the debugger, and the framework itself are released under Mozilla Public License v 1.1. To use Flex with Maven, you are going to want to download Flex from the Adobe site
If you want to use the Flex Eclipse plugin, you’ll need to fork over some cash. Flex Builder comes in two flavors Standard and Professional. Standard retails for $249 (USD) and Professional retails for $699 (USD). Yikes! Not cheap. The good news is that, unless you are creating a very complex application, you don’t really need Flex Builder. I happen to have a copy of Professional around for my own use, but I rarely use it because most of the work I’m doing in Flex these days is less visual and more about delivering data to the Flash client and programmatic creation of UI elements. If you are interested in buying Flex Builder, the main difference between Standard and Professional is that Professional has better testing support and charting/datavisualization components. But, I can’t stress this point enough, heavy duty programmers don’t really need the fancy UI.
The other thing to know is that there is a healthy community of Open Source that has grown around Flex like osflash.com and a number of projects providing open source components. (I wouldn’t be surprised if there is already another alternative Eclipse plugin which provides syntax highlighting and integration with the compiler. I just haven’t found it yet.)
Building Flex with Maven
Look around, you’ll see that a number of Java developers have blogged about integrating Flex with Java, here’s a survey:
- Probably the most recent, and the most interesting is Sebastien Arbogast blogging about his “full stack”. He’s got a rundown of using the flex-compiler-mojo to build an application that includes Flex/BlazeDS/Spring/Hibernate/MySQL. Anyone interested in using Flex and Maven should read Part I of Sebastien’s series.
- If you are looking for a whole application - check out igenko. If you are interested in seeing a working multi-module Maven project that uses the israfil-mojo. Browse the source of this application.
- Jacob von Eyben has created a Maven archetype which you can use to quickly put together a project that compiles Flex into SWC or a SWF. He has also created an archive that shows you how to create a Maven multi-project which copies a SWF artifact to a project with war packaging.
- Tony Hillerson provides an example of using the Maven AntRun plugin to build a Flex project on the InsideRIA blog. While this approach works, I think you’ll find using a Maven Plugin dedicated to the Flex compiler a better solution.
Personally, I used Eyben’s archive as a starting point, and I’ve extended it using the israfil-mojo plugin to involve several projects of packaging SWF that all depend on a shared SWC. These SWFs are then copied into the WAR file during the packaging phase. This approach is useful, but if you are interested in using Adobe’s Flex Builder you should know that you may run into some problems. From my own experience, it appears that projects that don’t conform to Adobe’s file layout tend to have problems in the UI. (But, then again, I told you I’m not really using the Flex Builder IDE, I just don’t need it.)
Arbogast’s blog post (which I stumbled on via the Maven developer’s list) introduced me to the most recent stab at a decent Flex Mojo flex-compiler-mojo.