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 9 Next »

Getting Started with Maven

Maven was written to be a command line tool. So, go download the latest release and install it. To begin using Maven, you have to download and install it.

Begin here:

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 install is at /home/piratepete/Java/maven-2.0.4 . You should take a look at the directory contents. For Unix/Linux based systems a shell script is provided in the $MAVEN_HOME/bin directory called "mvn". For windows users it's "mvn.bat". Open the file up and you'll quickly see that I'm old school and referring to $MAVEN_HOME is incorrect. Maybe not incorrect but I'm going to be deprecated soon. Your environment probably should use $M2_HOME.

The reason to create a $M2_HOME is to save on typing in your $PATH line. You'll need to set $M2_HOME/bin in your path.

PATH=/home/piratepete/Java/maven-2.0.4/bin; or PATH=${M2_HOME}/bin

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 $MAVEN_HOME/bin directory.
For Linux in your user's profile you'll need:

PATH=$M2_HOME/bin;/usr/bin:/usr/sbin: ... /usr/local/bin:$PATH

For windows, under MyComputer/Properties you'll find an Advanced button. Select that you'll change the user or system parameter for Path. You might add something like this to the front of the Path statement:

Path=c:\Java\maven-2.0.4\bin;c:\Program Files;...

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

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

  • No labels