Friday, March 25, 2011

Metawidget: Full Speed To Maven

The next release of Metawidget (v1.15) represents a significant rearrangement of our source tree, as we migrate the codebase from Ant to Maven.

I'm not going to knock Ant: it's been a great build tool for us, and it's much more flexible than Maven in many regards. But there are some compelling reasons for us to switch:

  • Metawidget wires up existing technologies, and there are lots of them.
    I really like the idea of a single metawidget.jar that's easy to deploy and get running, but there are some use cases where this isn't sufficient. For example, perhaps you want to save space by deploying only those Metawidget plugins you actually use. Or perhaps you need to deploy different plugins on different application tiers.

    We need a path from the easy-to-use but monolithic metawidget.jar to this 'fine-grained' use case. Maven gives us this path. So with v1.15 you'll be able to do either...

    <dependency>
       <groupId>org.metawidget.modules</groupId>
       <artifactId>metawidget-all</artifactId>
    </dependency>

    Or you can specify fine-grained dependencies...

    <dependency>
       <groupId>org.metawidget.modules.faces</groupId>
       <artifactId>metawidget-richfaces</artifactId>
    </dependency>
    <dependency>
       <groupId>org.metawidget.modules</groupId>
       <artifactId>metawidget-jpa</artifactId>
    </dependency>
    <dependency>
       <groupId>org.metawidget.modules</groupId>
       <artifactId>...other modules...</artifactId>
    </dependency>

    Maven will automatically drag in related dependencies for you, such as org.metawidget.modules:metawidget-core.
  • Metawidget needs lots of high quality examples.
    Whether it's examples on how to run Metawidget on Android, or in GWT Hosted Mode, or with JSF 2, or how to write custom Inspectors or WidgetBuilders - high quality examples are critical. Maven lets us compose each small piece of Metawidget (every example, every plugin) as a standalone project. This makes it easy to use tools such as m2eclipse to open the individual pom.xml in your IDE and start experimenting!

  • Some great tools play nicer with Maven.
    Tools such as Jenkins and Sonar, which should have a direct bearing on maintaining our code quality.
Don't Panic!

To ally any concerns, allow me to stress:

  • Metawidget v1.15 will be backwards compatible with v1.10.
    In fact, the binaries will be almost identical. Only the build system has been rewritten.
  • Metawidget will not require Maven to use.
    We will still be packaging metawidget-1.15.zip and metawidget-1.15-src.zip distributions that you can download, just as before.
All up, I don't think anything will be lost (apart from sweat and tears rearranging the code) and hopefully a lot will be gained. I've branched the old v1.10 codebase in SVN and checked in an early copy of the Maven version. I'd say it's about 75% done (and has nearly 100 POMs!)

I'd be most grateful to anybody who could check it out and provide feedback.

0 comments: