Flex 3 SDK + Eclipse : an encouraging union

Posted on February 18, 2008
Filed Under Computing & Software Systems | 13 Comments

On one of those rare occasions that I could be arsed to go out of my way to use precious “day-off” hours to tinker with software, I decided to find out how hard it would be to build flex apps without Adobe Flex Builder. With excellent (if outdated) starting points such as Darren Schall’s post and another update from Todd Sharp at cfsilence , I couldn’t really go wrong.

Barring a few hiccups, I was able to stand back and marvel at how awesome it is when bits of software from different walks of life just come together and play nice…

Getting a flex/eclipse dev environment going

After a fresh Eclipse install, I also needed the MDT-OCL, MDT-UML, EMF-SDO, GEF, XSD and VE-runtime (“JEM”) plugins. (I’m not sure why the graphical stuff is needed – haven’t yet figured out how you’d emulate flexbuilder’s design view… but maybe that’s not what those components are for). The best way to clue up on those eclipse features is to google “eclipse <plugin-name>”. Yeah I know… what would we do without google.

Eclipse

Eclipse, which I love (without necessarily being in love with it), has these ‘update managers’ that are *supposed* to let you install plugins just by pointing at update urls and having eclipse take care of the rest. Hmm.. not quite so. One of the eclipse projects (I forget which) had an update url which was broken purely because of a link to an xsl stylesheet that wasn’t even there.

Also, plugin dependencies at installation time (reminiscent of pre-friendly linux distro behaviour when installing software) made getting all those extra features installed a bit of a pain. In the end I just shoehorned them in by downloading the necessary .zips and extracting ‘em all over my eclipse install. Hey – it worked. But Eclipse loses points (from the point of view of this silly afternoon venture) because this was the step that took the most time.

However: Eclipse redeems itself almost completely with the ease with which you can associate the .mxml and .as file types, right down to specifying xml templates (kinda like fragments of xml) that are used during flex development. Which brings me to my next point: the flex xml schema itself.

Flex 3 Beta SDK

Adobe does not ship the XML schema definition file with the “free” SDK. Read that line again. Yeah. I really was *incredibly* pissed off about that. This is basically a complete refusal to allow another application to understand anything in the flex realm. After I calmed down though, I started to think that maybe this omission was perhaps a corporate strategy. There’s very little left that the full-featured Flex Builder application has going for it if Adobe just hands over the .xsd file. Anyhow. 10-billion demerit points for the SDK! For I dunno… poor interoperability.

In the end, I had to make do with the only version of the mxml schema still hanging around on the net: It’s a flex 1.5 .xsd modded over to ver 2, but well. It’ll do for now.

(Again, Eclipse gains points for easy integration of the xsd, after which – hey presto! – you have code completion).

The SDK also loses a few points for a rather frightening message when you run the compiler: a notice that it will expire in 30 days. I was like, “what?! I thought this was free / open source!” More effing and blinding then, until I come across something online that explains the notice: apparently it just allows them (Adobe) to halt support of older versions and betas, etc., but the sdk will always be free.

The other bit of weirdness with the SDK is that the compiler (mxmlc) couldn’t find my java runtime, which everything on my system up until now has been able to find. I don’t know why having the JDK in my PATH variable didn’t suffice. In the end I also added JAVA_HOME to my environment vars (I must have deleted it a while back) and it was happy.

FlashDevelop

FlashDevelop is an awesome little source editor for AS2 / AS3 that requires the .NET runtime. This is what I told eclipse to use as my actionscript editor. Flashdevelop and .NET are outside the scope of this post though – they both did their job and didn’t need tweaking, nor is either required for getting up on flex development with eclipse.

Ant

OK. So at this point, I can edit flex files, but now I need a way to build the final application. Enter Ant, the spidery make tool from Apache heaven. It has its quirks, but it really does do exactly what it says on the tin and in no time I was able to compile mxml and as files, apply a html wrapper, populate all the variables in the wrapper on the fly and see the results in a browser.

Verdict

I’m still impressed with Adobe for even handing out the SDK, and it’s great to have something like this to build both UI and backend systems – certainly it’s a huge improvement on Flash.

In terms of which tools were designed for playing nice with other systems, and for behaving in an expected manner, the ranking is as follows:

  1. Eclipse (the most complex piece of the puzzle, but it did all the heavy lifting)
  2. Apache Ant (the least troublesome)
  3. Flex 3 beta SDK (a bit standoffish, but plays along)

All in all though, the end result is definitely a viable system for roll-yer-own flex development – not to be scoffed at!

*********************************

UPDATE JAN 2010 :

Things have moved on, but it appears a few people still hit this page – I would recommend building your solution around FLASHDEVELOP instead…

Tenuously Linked (blame my tagging):

Comments

13 Responses to “Flex 3 SDK + Eclipse : an encouraging union”

  1. Dustin on April 5th, 2008 10:13 pm

    hi there. Thanks for posting this. I am trying to get the free SDK running in eclipse on my Mac. Any chance you can post or otherwise make available the xml you had to mess with? And where does it go?

    thanks!
    Dustin

  2. leona on April 8th, 2008 7:56 am

    Hi Dustin,

    you can check out this link: http://code.google.com/p/xsd4mxml/downloads/list
    posted by Tom Chiverton over at http://thefalken.livejournal.com/ for the flex 3 xsd!

  3. Brian on April 14th, 2008 7:23 am

    How did you setup Apache Ant in eclipse so you can build your flex application? Can you explain further?

    Great post. Been very helpful. Thanks!

  4. leona on April 14th, 2008 10:03 pm

    Brian, thanks for stopping by. Have a look at this other post as a place to start:
    http://systems.tinuum.net/?p=74

  5. Brian on April 15th, 2008 8:54 am

    Its nice to finally have a semi-”Flex Builder” replacement. I just wish there’s auto-completion for custom components and AS3 plugin for eclipse. :)

    Thanks again!

  6. Ant, Flex, Eclipse. : systems.tinuum.net on April 16th, 2008 1:31 am

    [...] Fire up your cooked version of Eclipse which by now, thanks to all your prior hard work, plays nicely with the Flex 3 [...]

  7. Lee Probert on May 26th, 2008 2:08 pm

    I installed the WDT and the schema but am not getting the auto-completion features. I didn’t install all the other plugins however … are they really necessary?

  8. James on June 10th, 2008 4:29 pm

    Thanks! That was very useful! Is there anyway to get actual Actionscript code completion within Eclipse (for example, if you have an mx:Script tag within an .mxml file)? Or is FlashDevelop the best solution for Actionscript editing?

  9. TeodorB on July 28th, 2008 7:49 am

    Thank you very much for this useful information. I’m planing the learn Flex but the my trial FlexBuilder trial expired (although it was uninstalled), so I was looking for a way to edit mxml files.

  10. chin on August 17th, 2008 4:45 am

    Thanks very much for the information. Can you provide some information about how to create a flex3 project in eclipse using the above setup? I am new to flex and will be of great help.

  11. Abdul Areef on September 9th, 2008 11:00 pm

    i would like to know how to connect the Adobe Flex 3 with Eclipse(which has j2ee), please explain by steps, its useful to me,plug-in the flex with Eclipse.

    thanks
    Areef

  12. Sandra on January 27th, 2009 5:01 am

    Nice work! I’ll have to do a cross post on this one ;)

  13. Drew on March 13th, 2009 1:33 pm

    nice post, cheers!