Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Getting Started with Maven

General

Although Maven can be used integrated in your favorite IDE, its basic usage is as a commandline tool. So, go download the latest release and install it. To begin using Maven, you have to download and install it.

Begin here: http://maven.apache.org/download.html

I started with Maven 2.0.4. Download the binary distribution that suits your operating system, e.g. tar.gz (linux), or zip (windows). Unzip the contents to directory that is accessible to your user. My installation is at /home/piratepete/maven-2.0.4 .

However, we can't use Maven just yet. Maven requires two environement variables: M2_HOME, and JAVA_HOME. M2_HOME refers to the directory where you unpacked your Maven, while JAVA_HOME, refers to your JDK directory.

For Unix users: 

and

For Windows users:

and

Environment variables are handy e.g. if you change things a lot. After you install Maven you'll need to set your PATH to the $M2_HOME/bin directory. Although modifying the PATH environmental variable is not required, it is highly recommended so thatyou can use Maven outside its installation directory.

For Unix users: 

PATH=$M2_HOME/bin:$PATH

For Windows users:

Now open a terminal or cmd window. Type the following and you'll see something like:

piratepete@piratepete-laptop:~$ mvn --version
Maven version: 2.0.4

or

Maven for Make and GNU Autotools users

Please Contribute

Icon

This section is incomplete. If you have experience with Make, Maven, and/or the GNU Autotools, please add any information here that you think might be useful to new Maven users.

Since both Maven and the GNU Autotools are involved with configuring and executing a software build, there is much overlap in their capabilities and the scenarios in which they are used. However, there are also some significant differences. It is hoped that this section will help bridge the conceptual gap between these tools.

From this point on, our discussion of Make will be implied by discussion of the GNU Autotools. We do this in part to simplify (in the future we have separate Make and GNU Autotools sections of this page), and in part becuase the conventions used by hand-rolled Makefiles are generally a subset of the requirements documented in the GNU Coding Standards.

Over the years a number of conventions have come into widespread use for expected targets and behaviors in Makefiles. The "best practices" in this area are documented in the GNU Coding Standards (in particular, see the "Makefile Conventions" subsection of "The Release Process" section.

In Make, the developer typically supplies (at least) the following targets: all, clean, and install, and often times check (or test), as well.

In Maven, the "targets" are really the names of a phase of one of the maven lifecycles. There are three Maven lifecycles: default, clean, and site.

Users and developers familiar with the conventional Make target install

  • No labels