Maven Unexpected: An Abundance of Flex Mojos

by Tim O'Brien

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:



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.

6 Comments

Ryan Heaton
2008-04-13 19:27:00
Enunciate also has it's own Flex compiler built-in with it's Maven mechanism, too. It's used to compile it's generated client-side ActionScript code used to access JAX-WS-defined Java service beans via AMF.
Tim O'Brien
2008-04-13 19:54:03
(Ryan neglects to mention that he created Enunciate).... You've identified the topic of the next blog post. I've seen Enunciate, but I've never taking the time to pick it up and drive it around the block. I think I'm going to do that tomorrow. Last I checked, it has a Maven plugin, right? And, an archetype?
alpha
2008-04-13 20:35:46
I think Flex 3 won the RIA's war, From Python with Django to Java with Spring and Maven and to PHP I see a lot of momentum with Flex. JavaFX it's a fiasco, SUN mistake again and who the hell will use Silverlight? meh.


Nice article by the way.

Jan
2008-04-13 23:51:38
I don't know how you came to the idea that Maven is/has gained momentum. I see more and more people walking away from it. What's needed is a build environment that works 100% of the time and not 60% or maybe in 2.0.9, 85%. The blog you're pointing to has the following title: "2.0.9 brings a bit of stability to plugin versions". I especially don't like the *bit of stability* part of this sentence.
kocka
2008-04-14 00:54:34
I can't wait to try this new mojo for flex 3. I managed to integrate flex 3 compiler into eclipse, so now I really do not need an expensive adobe tool to go with flex :)


Btw maven: I see maven coming to big companies, it is really about becoming mainstream.

Tim O'Brien
2008-04-14 04:08:39
@Jan, 60%, 85%, are you pulling these numbers out of the air? Or, are you pulling them from somewhere else? A few years ago, in teh absence of good documentation, people who had problems with Maven had a right to complain. These days, there are so many good resources on the subject, if you are having a problem with Maven there is a good chance that you are either too impatient to learn the tool or you just don't know how to ask for help. The fact that there are so many people outside of the Maven community writing plugins is a sign that it is just starting to deliver on the promise.