For many years I was convinced that Maven was a plot to bring the community of Java developers to the point of extinction. It is very slow in development, overengineered and imposes a set of standards where a 20 line build script would suffice.
On the other hand I was always envious of the way Maven manages dependences and downloading 20 megs of dependencies every time I do a fresh checkout was a bit of a embarrassment. Well, last week it all changed.
What happened is that Kristian Rosenvold contributed a JavaRebel plugin. Him being a fan of Maven and me being a fan of JavaRebel we wanted to find some way to set up a Maven repo for various JavaRebel projects that wouldn’t expose me to the things I consider unholy. Lo and behold, the Maven guys have figured out our pains and provided the nifty library called the Maven Ant tasks.
Now this maybe ancient news to the Maven community, but being a hardcore Ant hacker I have always thought that Ivy is the best and latest in the Maven-Ant integration game. Ivy does the job, but it is a pain to configure and even after three years still very buggy. The Maven Ant tasks can use the standard Maven pom.xml files if you like them, or to configure everything in Ant if you don’t.
The basic gist is that you put the following three lines in your build script:
[xml]
[/xml]
This gives you a path dependency.classpath that includes all your dependencies and that you can refer as pathref or classpathRef. It is also possible to get a fileset of dependencies as well as individual dependencies using properties of the form ${groupId:artifactId:type}.
With the dependencies in such a form it’s trivial to use them even in existing build scripts. You just replace your current paths and sets with the Maven ones an voila — you get a hackable Ant script with all the pleasure of Maven and without any of the pains.
Tags: java