Maven Installation

Install Maven

We will use maven to configure and build our project infrastructure and run our test using the maven integration-test phase.

1 Download latest Maven.

For Windows: Download mavan Binary .zip

Extract under C:\Program Files

For Mac: Download Maven Binary .tar.gz

2 Setup Maven in Path.

We setup PATH environment variable so we can conveniently run various executable from any directory without having to type the full path of the command. If you do not set the PATH variable, you need to specify the full path to the executable every time you run it, such as: "C:\apache-maven-3.0.4\bin\mvn". To read more about PATH you may visit this link http://docs.oracle.com/javase/tutorial/essential/environment/paths.html.

For Windows:

Launch System Properties for setting up MAVEN_HOME

Open Explorer > Right Click Computer > Properties > Advanced system settings > Environment Variables > System variables > New

Variable Name: MAVEN_HOME
Variable Value:  ex. C:\apache-maven-3.0.4

Note: The variable value depends on where you extracted maven. The above is as on my system.

Update Windows Path

Open Explorer -> Right Click Computer -> Properties -> Advanced -> Environment Variables -> System Variables
Select "Path" and then Click "Edit". Then Add ";%MAVEN_HOME%\bin" at the end and  then click "OK".

Ensure java is installed. Open a NEW command prompt and run mvn -version command.

For Mac:

Open ~/.bash_profile and set MAVEN_HOME in PATH

M2_HOME=/home//apache-maven-3.0.4
export MAVEN_HOME

PATH=$PATH:$HOME/.local/bin:$HOME/bin:$JAVA_HOME/bin:$MAVEN_HOME/bin
export PATH

Ensure java is installed. Open a NEW terminal and run mvn -version command.

3 Setup .m2 repository.

The .m2 or maven local repository is a local folder that is used to store all your project’s dependencies (plugin jars and other files which are downloaded by Maven). So when you build a Maven project, all dependency files will be stored in your maven local repository. By using maven local repository, we avoid duplicate libraries in our machine and dependencies are easily managed.

For Windows:

A. Create an ".m2" folder under the user home folder

B. Configure settings.xml for .m2.

You can get the settings.xml from http://github.com/jspringbot and place it under the user home folder.

Comments

comments powered by Disqus