Wednesday, August 27, 2008

Flex and Java and Me - Getting Started

The technology stack I'm going to use is flex, actionscript 3 .. using pure mvc, mate, or caingorm ( this requires another writeup) for the front end. Back end will be using java - spring , hibernate. So now that the easy stuff is out of the way, I'm going to setup the frame for the project using maven to manage dependencies, and builds. I went through this tutorial Flex, Spring and BlazeDS full Stack, and it was very good to get a good start running on the build and management tools. I will build and expand on this tutorial, to organize and manage everything easier.

Adobe released Flex Builder Linux. Im using alpha 4 currently. Start with getting eclise 3.3 as I issues with ganymede 3.4 and Flex Builder alpha 3, but may have been resolved with alpha 4. Also I'm using Q for Eclipse plugin.

Refer back to the original tutorial I followed for most examples.
So to start first thing to do is create a root project. This is where all modules will be placed under. In eclipse or maven directly create a project archetype quick-start.
1. delete the "src" directory, its not necessary.
2. Edit pom.xml change packaging to "pom" instead of "jar"
3. create a maven module for your flex for example projname-ria.

Creating a Flex Module
Create a maven module under the root project. The archetype is the maven-archetype-flex.
To have maven handle the adobe flex dependencies and to compile, I am currently using the - flex mojos - project. Some really excellent work is being done on this project. Refer to my writeup here - flex-mojo - getting started

Creating - Java
Next I wil create a core module - maven-archetype-quickstart and a web module - maven-archetype-webapp. The only thing I would consider is creating a commons project. If you intend on creating library reusable classes, then its probably good to create it as a separate project. Refactor later.
Now for dependencies, add Spring 2.5.5 , and hibernate 3.2.6.ga as these are pretty much the middle tier and persistence tier frameworks we will be working with.

Now pretty much follow the tutorial for the configuration module, and the plugins to put everything together. The only other catch is in the mxml files refer to the full namespace


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"



and in the article they just refer to /2006/mxml and you will get compile errors.