Home > Articles > Programming > Java

Ant User, Let Me Introduce Maven

  • Print
  • + Share This
Ant user? Meet the new kid on the block: Maven. Webster's Dictionary says that "maven" means "experienced or knowledgeable," and this product lives up to its moniker. In this introduction, Marcus Zarra walks you through a sample development project using Maven. See how using Maven can give consistency and ease of use to your Java development projects.
Like this article? We recommend

Ant, which is the de facto standard for Java development, is an extremely flexible tool that allows for a nearly unending set of tasks and configurations. With a little bit of work, you can create a build file to match any possible development environment. This flexibility comes at a cost, however. It is quite possible, even relatively easy, to build an Ant development environment that is completely unportable. Although this may be of little or no consequence in a one-man development environment or even in a small team, it can be deadly to a project with a wider scope.

Maven solves this problem rather neatly. Because Maven is built on top of Ant, it can do anything that Ant can do and much more. However, one of the basic assumptions that Maven makes is that the developer (and therefore the development environment) will follow some basic guidelines. These guidelines include where source code is located, at what point in a build cycle unit tests are to be run, how a jar file should be structured, and so forth. This will more than likely cause initial irritation to the developer, but the end result might well justify the means.

Installing Maven

To start using Maven for your project management, it must first be installed. Get the latest version of the tool here. After you have downloaded the latest version and installed it, the first thing you want to do is execute "maven" on the command line without any parameters. The location that you execute this from is not important at this point because the first execution is merely setting up Maven's repository. Your console should look something like this:

 __ __
| \/ |__ _Apache__ ___
| |\/| / _´ \ V / -_) ' \ ~ intelligent projects ~
|_| |_\__,_|\_/\___|_||_| v. 1.1-beta-1

Plugin cache will be regenerated
Total time  : 21 seconds
Finished at : Wednesday, June 22, 2005 3:06:03 PM MDT

Now that the repository is built, you can look at it. On a Unix system, it is located in the directory .maven in your home directory. This is where all the libraries will be stored that Maven downloads. It also retains an MD5 hash of the libraries for comparison purposes. Maven is now set up and ready to use.

  • + Share This
  • 🔖 Save To Your Account