I will FlexMojo no more

25.06.09

Filed Under: Flex

Being a Java developer my preferred tool for building applications is Maven. Adobe does not seem to know of this tool which as been the industry standard for some years time and therefor there are no official Maven plug-ins for building Flex applications. I have used Israfil and Flex Mojos for some time and my experience is that none of them are worth the trouble.

The dead horse

Israfil is a dead project in my opinion. The main contgributer does not add new features and people tend to just fork it and build their own version without being able/willing to commit it back to the project.

The "new " kid on the block

At first glance Flex Mojos looks like the right tool for the job, however after using it for some time I think it’s not worth the trouble and I will try to explain why.
It is a bad idea (and maybe not legal) to have the Flex SDK as a dependency in you POM. §Using the compiler Java API is also a bad idea as you get situations where your code builds just fine in FB and breaks when using Flex Mojos. This is extremely annoying and you have to spend a lot of time on something which is a waste of time.

Maven is just too strict

One thing which all Maven plug-ins have in common is that they enforce you to structure your Flex projects to suite Maven’s needs instead of what make sense. The concept of one artifact for each project does not work well with the Modules feature in the Flex framework. Nor does it provide an easy way to compile CSS-files to SWF-files without creating a new project. The Maven requirement makes you have to add a lot of complexity to your project as you need to create a lot of modules and projects just because of a requirement which makes no sense in Flex development.

What’s a girl to do?

What do I recommend? I recommend using the Flex Ant Tasks that ships with the SDK and use the Maven Ant Runner plug-in. This solves the problems mentioned related to Flex Mojos and it allows you to benefit from all latest innovations in the SDK right off the bat. With the plug-ins you have to wait for any new feature to be implemented.

Disclaimer

I do not write this to piss off the authors of the plug-ins mentioned as they are all doing a great job. I really hope you get the plug-ins right so that I do not have to maintain Ant build scripts, so the best of luck to you. However I just felt that I should come clean and say what is my preferred way of building Flex applications.

6 Responses to “I will FlexMojo no more”

  1. VELO

    Hi,

    Sorry to hear you had a bad time using Flexmojos.

    I hope that was a problem on Flexmojos 1.0, but you post is too recent to that be the case.

    About your Flexbuilder issue, probably some config that you put on FB or FM and didn’t put in the other, kinda expected.

    About CSS to SWF that is true, maven needs a pom.xml,
    ant needs a build.xml, flexbuilder needs .actionscriptProperties…. that must be stored anywhere, unless you wish to invoke mxmlc manually each time =D

    I’m curious what issue did you had with modules. I saw no jira ticket or discussion on users list coming from Espen or Espen Dalløkken, so either you didn’t report your problems or you did that using a nickname. Either case I would like to know what happened.

    Comparing Flexmojos and Ant tasks is kinda unfair…. for 2 main reasons:
    1 – is hard to guess when adobe add any new feature to Flex, so I can add new features before know they exists.
    2 – Flexmojos has much more features then Ant tasks, like war creation, locales resource bundle generation, asdoc support and more…

    Anyway, if you missed any Flex feature on Flexmojos I would like to know that too.

    VELO

  2. leftieFriele

    Hi Velo, first of all I think you are doing a great job and I know loads of people who reap the benefits of your work with Flex Mojos. So keep up the good work!

    When it comes to my posting I am more or less just describing my personal preference after having worked with the two Maven plugins. I dislike every moment I have to spend in Maven’s POM files as it tends to be somewhat of a black hole when it comes to taking away my time. Therefor I like things to be easy and personally I find using Ant to be the easiest. As it allows me full control and I can take advantage of new stuff from Adobe from day one.

    Most of my issues are with Maven and it’s one-artifact-per-module and my own inability to debug anything that goes wrong when the magic that is Maven brakes down. It is not as much with any of the plugins.

  3. VELO

    I see…

    Well, using maven + ant-run + ant tasks won’t get you rid of pom… quite the opposite, you still have the pom and will have the build.xml embed on it…

    If you are used with ANT, maven is a big change. On ant you say: do this, do that and that. And ant does. On maven you say: this is a SWF project. Magic happens.

    I had troubles on my own when I was forced to start with maven. Today I thank a lot the guy who forced me into maven.

    On Flexmojos we kind workaround this one-artifact-per-modules (at least for modules), still far from what people consider ideal, but with feedbacks we can improve. Personally I hate producing N swf from the same set of sources. That usually lead into problems like duplicated class definitions on modules, but ok… who am I do disagree =D

    Anyway, if you had any idea or even had any problem that you found impossible to solve with Flexmojos I appreciate if you could share that with me, then I could improve it.

    And just for the record, I completely disagree from “I can take advantage of new stuff from Adobe from day one”… there still features uncovered by ant tasks. Right now what you said is only possible using mxmlc, compc, optimizer, asdoc, digester, ….. all from command line

    VELO

  4. leftieFriele

    I have no issues with Maven for Java development and I am fully aware of the benefits of using Maven over Ant. Therefor I have no desire to substitute Maven for Ant in general, just when it comes to Flex.

    The point about using new stuff from Adobe is very much valid as I don’t need a feature to be in the Ant tasks to utilize it. Like you say I can just call it using the command line tasks from day one.

    Just last night I tried to setup a new project with FM just because I wanted give it another go. I ended up fighting with the dependencies to playerglobals and I just gave up, as neither the super-POMs in the FM source tree nor any of the suggestions on the mailing list solved my problems. Having to resolve dependencies which are internal to the SDK is something which I can’t be bothered with having to deal with.
    I think that having the pieces of the SDK as Maven dependencies is a bad decision and it just adds complexity to using FM. If I could just point to my SDK and say “look over there Flex Mojos” it would make life so much simpler and I wouldn’t have issues like the one I had last night. Maven requires JAVA_HOME in order to execute and a similar approach could make life easier for FM users too.

  5. VELO

    Having dependencies on repo is the only way to be sure what version you are using….

    That even allow you building the same sources with different flex versions, if you need to be compatible with more then one version for any reason….

    Makes no sense compare with Java here. Java has much less releases then Flex and Java keep compatible between releases. Anyway, if you like this approach, you could try israfil mojo… as you said dead horse, but does like you like =D

    But anyway, you shouldn’t need to fight any dependency. I had all deployed on flexmojos repo, may be that shows helpful:
    http://www.sonatype.com/books/maven-book/reference/ch20.html

    It should be very strait forward approach.

    VELO

  6. boyetp

    Hi there,

    I hope somebody can help me.
    I’ve been trying to compile a flex component with flexmojo.

    in my src/main/flex I have a as Class file
    App.as
    ================================
    package com.test {

    public class App {
    include “TestIncl2.as”;

    public function App(){
    super();
    }

    public static function greeting(name:String):String {

    return “Hello, ” + name;
    }
    }
    }

    and an as file(not a as class)

    TestIncl2.as
    =================
    private var _test2:String;

    public function set test2(p:String):void{
    _test = p;
    }

    public function get test2():String{
    return _test;
    }

    ==================================

    using mvn compile

    maven will also compile the TestIncl2.as

    which will get an error.

    How do I exclude this file in the pom.xml?

    Henry

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feed (this is global, not just for this entry)

Categories