Basic Maven Installation

1- Download latest Maven library from the following URL http://maven.apache.org/download.html. .

2- Unzip the file at some proper location (in my case its C:\Program Files\Apache Software Foundation\apache-maven-2.0.9).

3- Make sure your JAVA_HOME environment variable is set to Java home directory.

4- You need to setup two environment variables for Maven

  • M2_HOME
  • M2

For Windows:

Go to My Computer > Properties >Advance tab > Environment variables > Under User variables > New and provide both M2_HOME and M2 environment variables. M2_HOME will be upto the home directory where Maven is extracted while M2 will be equal to %M2_HOME%\bin.

For Linux:

Go to your home directory > in the view menu, check “show hidden files”. Open “.bashrc” file in an editor like gedit.

At the end of the file add these three lines

 export M2_HOME = Path_To_Maven_Home_Directory

export M2= Path_To_Maven_Bin_Directory

export PATH = $PATH: Path_To_Maven_Bin_Directory

 5- You also need to update the PATH environment variable in case of windows in order to access Maven commands from console. Go to My computer > properties > Advance tab > Click Environment Variable Button > under system variables find PATH variable > Click Edit and at the end provide the path up to the bin folder of Maven. In my case it is C:\Program Files\Apache Software Foundation\apache-maven-2.0.9\bin

6- To verify that every thing is setup according to the plan open console and type mvn –version. You should see something similar to the following figure.

See also:

http://maven.apache.org/ , Maven project home page

http://maven.apache.org/download.html, Download and detailed installation instructions.

http://today.java.net/pub/a/today/2007/03/01/building-web-applications-with-maven-2.html, introduction to maven commands and building a web application in maven

Published by

Ali

Some day I'll fill this up. Till then Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo ....

Leave a Reply

Your email address will not be published. Required fields are marked *