Musings on Maven
Those of you who know me, probably know that I’m not the biggest Maven fan in the world. I have, historically, resisted integrating Grails strongly with Maven and the work on the Maven plugin for Grails has been fleeting at best.
I have grown to be a strong believer in the future of Gradle and for Grails 3.0 we are in all likelihood going to be migrating Grails to Gradle as its primary build system.
So why post about Maven now? Like it or not, I have to admit that Maven is still largely dominant as the build system of choice for the Java world. Ant has a fair amount of builds out there, but I guess with all of its flaws Maven is “good enough” for most people.
I could argue until I am blue in the face on the technical downsides of Maven, it isn’t going to change the fact that there are many people who do like it and are successful with it on a day to day basis. A build like the one we have for Grails would never fit Maven’s model. We have complex packaging requirements and the complexity of writing Maven plugins would make our build unmaintainable in comparison to what we have now with Gradle, which is a simple build in around 264 lines of Groovy.
However, the general problem is the existing populace of developers who are using Maven, many of which want to use Grails, but unfortunately our existing integration with Maven (the build system) has been relatively poor, even if we integrate reasonably well with the Maven repository format.
Fundamentally, people want to build Grails applications as part of a multi-project Maven build, and we have to accept that is a reasonable thing to want to achieve. I will be the first one to admit I have largely neglected the Maven plugin for Grails and relied on external contributions / others to keep it going. So starting next week I’m going to start working on making a much better Maven plugin that integrates more natively with the Grails applications and is able to build applications without delegating to Gant scripts.
I am also going to work on an adapter for our custom repository format in the Maven repository format so that Maven users don’t have to repackage and publish Grails plugins to their own repositories as is the case now.
This work will also help us extract our build logic from the clutches of the Gant scripts we currently have which will ultimately benefit the migration to Gradle. Starting with Grails 2.1 you will be able to easily build Grails projects as part of multi-module Maven builds and rely on Maven completely for the management of dependencies. We’re also going to make sure some basic things like mvn jetty:run work with Grails as well.
In the meantime we will be releasing the Maven plugin for Grails in its current form for usage with Grails 2.0. This should get folks who need to build Grails application with Maven some of the way until the more refined integration is complete in Grails 2.1.
Off I go to familiarize myself with the Maven plugin API….