This Article provides a complete guide to setup Apache Maven in your Windows or Unix based environment(Linux, Solaris and Mac OS X). Maven version used in this article is Apache Maven 3.1.1.
Download the latest Maven version from Apache Maven site for your environment. Unzip or Untar it on your preferred location in your machine.
On Unix based system (Linux, Solaris and Mac OS X), users can use tar command to do the same
$>tar zxvf apache-maven-3.1.1.tar.gz
On Windows, users can use tools like 7zip/winzip to unzip apache-maven-3.1.1-bin.zip.
A directory named apache-maven-3.1.1 will be created as result.
Create an environment variable named M2_HOME
which refers to directory where maven was untarred/ unzipped. and then add this variable to PATH
environment variable.
On Unix based system (Linux, Solaris and Mac OS X)
Add an environment variable named M2_HOME
$>export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1
Then add this M2_HOME variable to PATH
$>export PATH=$M2_HOME/bin:$PATH.
On Windows
Right click Computer->Properties->Advanced System Settings->’Advanced’ tab-> ‘Environment Variables’
then Add a new ‘User Variable’ named M2_HOME in user variables section
Click OK, then Edit the ‘Path’ user variable to add M2_HOME\bin
folder in it.
Click OK.
Make sure that JAVA_HOME
environment variable is set to the location of your JDK installation
, and $JAVA_HOME/bin is in your PATH environment variable.
On Unix based system (Linux, Solaris and Mac OS X)
$>export JAVA_HOME=/usr/java/jdk1.6.0_45 $>export PATH=$JAVA_HOME/bin:$PATH.
On Windows
It’s done.
Execute command mvn --version
to verify maven installation (same command for both windows and Unix).
E:\>mvn --version Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:2 2+0200) Maven home: E:\Tools\Build tools\apache-maven-3.1.1 Java version: 1.6.0_45, vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jdk1.6.0_45\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Above output shows that Apache Maven is installed successfully.
If you like tutorials on this site, why not take a step further and connect me on Facebook , Google Plus & Twitter as well? I would love to hear your thoughts on these articles, it will help improve further our learning process.
In this post we will be developing a full-blown CRUD application using Spring Boot, AngularJS, Spring Data, JPA/Hibernate and MySQL,…
Spring Boot complements Spring REST support by providing default dependencies/converters out of the box. Writing RESTful services in Spring Boot…
Being able to start the application as standalone jar is great, but sometimes it might not be possible to run…
Spring framework has taken the software development industry by storm. Dependency Injection, rock solid MVC framework, Transaction management, messaging support,…
Let's secure our Spring REST API using OAuth2 this time, a simple guide showing what is required to secure a…
This post shows how an AngularJS application can consume a REST API which is secured with Basic authentication using Spring…
View Comments