The Apache Software Foundation has posted a "preview release" of Maven 2.0, an open source build tool for Java that's more declarative and less procedural than Ant. Maven is also much more authoritarian and less configurable than Ant. I've been using Maven lately as part of my work with the Jaxen project, and it has some nice features but I really can't recommend it. It's too controlling and I often find myself fighting against it. If your build process doesn't look like what Maven wants it to look like, you're going to be fighting against it. Maven's probably a little easier to set up than Ant for basic tasks like build, test, and deploy. However, as soon as you want to do something a little different than Maven expects, you're S.O.L. It's really Maven's way or the highway. According to the Maven site,
Maven 2.0 will feel very different to a Maven 1.0 user - and perhaps a little strange. But it is a lot simpler to work with! The key changes from Maven 1.0 are:
- Faster and smaller - The Maven core no longer uses Ant, Jelly or Xerces making it much smaller, has fewer dependencies and is perfect for embedding in other tools.
- Defined build lifecycle - No more
prereqs
,preGoals
andpostGoals
. The build is a series of well defined phases. This also means that the normal goal names are not used -compile
,test
andinstall
work for any project type.- Built-in multiple project handling - Use the same goals on a set of projects, and aggregate the results.
- Improved
SNAPSHOT
handling - Snapshots are now checked for updates only once per day by default - though can be configured to be once per build, on a particular interval, or never. A command line option can force a check - making it more like updating from an SCM.- No more properties files - All plugins are now configured from the POM (which is now called
pom.xml
).- No more
maven.xml
- Plugins are now easier to build and integrate, and are the only way to script your builds. (Note that additions may later be made to the POM to allow simple things that scripting was used for, such as goal aliasing).- No more Jelly - Plugins are primarily written in Java, though there are providers for other scripting languages. This release includes support for Marmalade, a scripting framework that supports an XML syntax similar to Jelly which can be used to integrate Ant tasks and has a Jelly compatibility layer.
- Improved repository layout - Maven 2.0 supports both the existing layout, and an improved repository layout that has deeper, partitioned structure making it easier to browse.
The elimination of Jelly and the use of Java should be a real improvement. Extending Maven 1.0 was vastly too difficult. If plug-ins existed to do what you wanted, it was no big deal. If not, you really didn't want to try writing your own. For instance, Maven supports the Clover code coverage tool I use for XOM but but not the Cobertura code coverage tool I use for Jaxen. It was easier to write a separate Ant build file just for test coverage than to write a Maven extension to support Cobertura.
On the other hand, I don't see any evidence that another major Maven flaw has been fixed. Maven 1.0 (and presumably 2.0) requires that all tests pass before it will do anything else: for instance, build a jar file or update a web page to correct a typo. That's just too extreme. Test driven programming is good, but one failing test should not break the build. In Maven it does.
Maven 2.0 is not ready for production use yet. For instance, it doesn't support any plug-ins, and there quite a few major, unresolved bugs; so even if you are happily using Maven today, I don't recommend moving to 2.0 just yet. However, 2.0 looks promising and does address a lot (if not quite all) of the complaints I have about Maven 1.0.
Ben Litchfield has posted PDFBox 0.7.1, an open source (BSD license) Java library for manipulating PDF documents and extracting contents from existing PDF documents. This is a bug fix release.