Apache Maven is a tool for managing software builds, especially for software written in Java. I've used a number of tools for managing software builds over the years. In my C/C++ days, I used the good ol' make tool, a la Unix. I have also written build scripts using Windows batch files and NetRexx.
In recent years, I've done my Java builds using Apache Ant. Ant is a great tool for specifying how to build a particular piece of software. Actually, it is a great tool for creating all sorts of batch processes, e.g. XSLT pipelines. However, what Ant doesn't give you much help with is managing your software's dependencies on particular versions of other components/libraries. This is where Maven comes in.
However, before Maven, there's an interesting bigger picture here. What do you get when you buy a commercial distribution of Linux? It isn't the software per se, since that is open-source. Part of what you get may be a box with some manuals (which I'm willing to pay for). However, the biggest thing you get from a Linux distribution is a coherent set of software versions that will work with each other. The great triumph of Linux, as I see it, was the creation of version management tools like rpm (the Red Hat Package Manager), which allows a software component to specify which versions of other components/libraries it is dependent on in order to run. With this information:
- your software can automatically abort its installation if the necessary software dependencies have not been installed;
- more sophisticated software installation tools can check which component/library versions you need (and which component/library versions those need, etc.) and then download and install everything that you need in one hit.
Without this facility, Linux would be unusable for the non-gurus of the planet, and those non-gurus make up the majority that Linux needs to win over if it is to be as successful as the pundits reckon it can be.
In that light, seeing how crucial version dependency management has been to the success of Linux, is it going to be less important for your own software builds? The bigger the software project, the more this is going to be an issue. So Maven takes a different view to Ant. Ant is about controlling the minutiae of software builds. Maven is about making each component's build environment and processes as standard as possible, and then managing the dependencies. Maven is build on top of Ant's functionality, but Maven seeks to hide the details of individual builds in a way that Ant typically does not.
Part of the magic that makes Maven work is that there is a Maven Web repository of the most widely used open-source libraries. So, if you try to build something that requires a software version that you don't have, Maven will look in its repository. If it is a standard item, Maven will retrieve the copy from its repository, and not force you to bother with the details. For your own local components, you can tell Maven to use your local repository first, so Maven can be used between teams on larger software projects to manage those version dependencies too.
I'm just in the early days now of moving some builds to Maven. One thing I have learned is that to use Maven, you need to have Web access enabled so that it can download its plug-ins plus libraries from its repository. Once you have downloaded these items once, you can do off-line builds without a live Web connection, but be aware that if you start to use any new Maven operations, you may have to be connected again. This is an issue in enterprise software development environments where software downloads may be tightly controlled. However, I definitely think it is worth the trouble.
Maven focusses your attention on the high-level details that matter most, rather than letting you wallow in unnecessary detail. That's always a good thing for software. Give it a try and let me know what you think. As a new user myself, I'm interested to know how other people get on with it.
Recent Comments