Friday, June 15, 2007

Install Maven On Your Machine

The problem:

You need Maven installed on your machine:

The solution:

Go to maven.apache.org and you will find the download you want. I recommend you get the newest 2.x release of Maven. Download Maven. Once complete unzip it onto your filesystem.

You now will want to create a MVN_HOME system variable to point to your installation (where you unzipped Maven). In Linux/BSD you will probably be adding this variable in your .bash_profile or .profile file in your home directory. Example:

export MVN_HOME=/usr/local/maven2.6
PATH=$PATH:$MVN_HOME/bin

On Windows you can add these vars through the control panel -> system -> advanced (tab) -> Environment variables (button). This is where you enter system variables for Windows. You probably only want to use Maven for your account, so create a new var in the top window. Name it MVN_HOME and set it's value to the location of Maven. Next, if you don't have a Path var in the user variables create one, set it's value to %MVN_HOME%/bin. (Windows tip, press windows-key + pause to bring up the system props).

Adding the Maven bin to your system path allows you to invoke via the command line anywhere . When you are done with the previous type 'mvn' and you should get an error saying you must specify a goal. This means you are ready to go!