07
Sep 06

To maven or not?

For the last year or so, I’ve been using maven pretty happily for most of my projects, other than the ones that I don’t initiate and am forced to use ant.

I was never a big fan of ant, mostly because of the startup time it takes to build a robust build.  Yes, most developers reuse builds from previous projects, etc…, but most of my projects have been pretty unique in structure, though I always had to do some tweaking.

Maven introduced a standardized build structure.  I love it, a simple maven command to generate the initial project structure and I’m off and running.  Any customizations are easily added, etc…

But honestly, the biggest reason I’m using maven, is its transitive dependencies resolution.  Well, at least in concept it’s great.  Also, I’ve been using it for the last year without any major issues.  I was using it with mostly popular libraries (dependencies).

The XQOM project has a few dependencies that I’ve been battling with.  Its internal XML/Object mapper is JiBX.  JiBX is an awesome library.  I think it’s leaps and bounds ahead of it’s competitors like JAXB, Castor, etc…  It’s basically in XML/Object mapping world as what Hibernate is in ORM world.  No, it’s not an XML persistence solutions, that’s what XQOM is, but you get the point.

So although JiBX is a greatly architected/developed library, it has some maintenance issues.  The developers are not big on keeping the maven repo up to date.  The artifacts that are available in the repo, have transitive dependency issues, missing pom files, etc…  The subprojects like maven-jibx-plugin and IDEA plugins, all use different versions, etc…  So what’s the problem, let’s see…

I’m using JiBX 1.1 for dependencies, runtime and compile time.  Because JiBX has some differences in bytecode enhancement code injection between 1.0.1 and 1.1, you can’t use a binding compiler of one version and runtime of another.  Well, that seems straight forward enough, right?  No…

maven-jibx-plugin has a dependency of 1.0.1, and though when it’s run, it’s post compile goal of bytecode enhancement is executed with 1.0.1 libs.  The code base has a runtime dependency on 1.1, though when tests are executed with surefire, they are executed using the runtime dependency of the  project, though there is the complaint about the version mismatch.  Can’t use 1.1 runtime to execute code compiled with 1.0.1 binding compiler.  One way of resolving this, is basically modifying the local POM for the plugin, that will use the 1.1 dependencies.

It gets even better.  The IDEA plugin is dependent on 1.0 RC1 version, so when I’m building with IDEA, to say execute my TestNG tests from the IDE, it yet again complains, because the project dependency is 1.1.

OK, maybe this is just one project that I ran into that has these issues and maybe they’ll get it together one day.  I used to hate manually installing sun libs, since they couldn’t be hosted at ibiblio.  Now, sun has setup a mvn repository, so it’s just a matter of adding it to your settings.

Aside from these difficulties and spending more time than I wanted to get it to work, I think Maven is great.  I’m sticking with it for now and the near future.  I just wish that more and more projects either update ibiblio and/or provide good maven repositories.  Maven is no longer an alternative build tool, it’s now mainstream just like ant.

2 comments

  1. I’ve updated the JiBX plugin for IDEA to JiBX 1.1.3 a few days ago (although it may only work with the latest EAP). Tonight, I’ll update this maven2 plugin as I’m in need of it too. I will probably maintain those two ones more actively as I’m using an XML database and am reliant on JiBX for most of my O/X mappings 🙂

  2. I’ve updated the JiBX plugin for IDEA to JiBX 1.1.3 a few days ago (although it may only work with the latest EAP). Tonight, I’ll update this maven2 plugin as I’m in need of it too. I will probably maintain those two ones more actively as I’m using an XML database and am reliant on JiBX for most of my O/X mappings 🙂

Leave your reply to jeje