Search Flex Samples

Experience of Developing Flex with Maven

If you are building a small Flex application then the Maven is of course an absolute overkill but if you are working in a team and have to release the application that uses Java then Maven is worth considering. I myself started to use Maven in the Flex project because of Java. As it worked well I tried to move on and use it also with Flex. It took some time but in the end I was quite happy when I could just type in the command "mvn install" and the Maven took the Flex and Java source code, compiled it, packed into a war and deployed to my Tomcat server. The major reason why I initially started to use it was that I had to share the project source code and it would have taken a lot of time to setup the environment in the other computers. With Maven, I ended up having only one property file which had environment specific stuff in it and I could set up the project in Mac and Windows without problems.

Luckily there was a well working maven plugin for building Flex and a tutorial for how to make it work. After setting up the multimodule project (webapp and flex), I used Maven for a while quite successfully. As Flex was so new for me and I had a lot to think about it, the length of the building cycle didn't bother me. Maven built nicely a war including the swf, deployed all this to a Tomcat server and everything worked fine. The more I studied Flex, the more there was to test and the faster I wanted to see the result. At some point it was clear that Maven plugin slows down the overall Flex development process since each time I changed something in Flex, I had to go through all the building and deployment process again. As I used the data services from GraniteDS, which were located in webapp, it seemed logical to redeploy the SWF with the web application if something changed. As usually, the reality was somewhat different. In the FlexBuilder one had to go to modules properties, choose the Flex Compiler from left and add to "Additional compiler arguments" following argument with reference to services-config.xml:

-services /Users/mv/programming/workspace/webapp/src/main/webapp/WEB-INF/flex/services-config.xml

After this change I started use Maven only for deploying webapp's Java contents and if something was changed in Flex, the Flex part was built automatically by FlexBuilder, taking into account the services config file. The rebuilt Flex layer was then ready to be executed locally from FlexBuilder in normal, debug or profile mode and it was able to call the services deployed to the application or web server. Therefore, I would use Maven for Flex rather for moving from development environment to test and to production as using it in development could slow down Flex development.


Related Flex Samples

Learn Flex: Flex Samples | Flex Video Tutorials Flex Examples