X
Business

Maven: A project management solution

Nontrivial software projects need build tools. In the Java world, there's no shortage of these tools, with Ant being the standard.
Written by David Petersheim, Contributor
Nontrivial software projects need build tools. In the Java world, there's no shortage of these tools, with Ant being the standard.

Maven is another project management/build tool on the open source scene. Maven, which is compatible with Ant, is a project management tool that takes Ant concepts several steps further. Maven isn't built on top of Ant, but it can take advantage of, and even generate, Ant build scripts.

In order to use Maven, you must first create a Project Object Model (POM). The default POM is the project.xml file. The POM describes your application and its dependencies. Maven uses the POM to build your project and related documentation. Once you have a basic project.xml file, you can use it as a template for all of your projects.

Maven has goals, which are roughly analogous to Ant's targets. Maven also has many useful predefined goals for compiling, deploying, generating documentation, generating Ant build scripts, and creating jars, wars, ears, etc. It's all built right in. And if there's something missing, you can build your own plug-ins without too much effort.

Two of Maven's coolest features are jar repositories and project site generation. Jar repositories are local or remote sites that contain jar files. When you document a jar dependency in your POM at build time, Maven will automatically download the necessary version of the jar into its local repository. This feature can make building your projects less painful. The project site generation goal creates a professional Web site of your project, including links to syntax highlighted source code, code metrics, javadoc, unit test results, and more.

One common (and valid) complaint about Maven is that sometimes it's slow. Some developers have resorted to using Maven to create an Ant file that they use for daily development, and then use Maven to distribute their projects or as part of a nightly build process.

In any case, the features that Maven provides make it deserving of at least a serious evaluation.

David Petersheim is the Director of Application Development with Genscape, Inc. He designs and develops server-side applications to acquire and process real-time energy data.

Editorial standards