Setup Menus in Admin Panel

What is Maven and how do I install it?

2. What is Maven and how do I install it?

To set up Maven, you need to:
  1. Download Maven and unzip it
  2. Create a JAVA_HOME System Variable
  3. Create an M2_HOME System Variable
  4. Add %JAVA_HOME%\bin;%M2_HOME%\bin; to your System Path

To begin with, download the latest Maven from I downloaded and extracted it to C:\ apache-maven-3.3.9.

apache maven1


Go to your System Properties → Environment Variables.


Create a JAVA_HOME System Variable and point it to your Java installation. I pointed mine to C:\Program Files\Java\jdk1.7.0_79


Create an M2_HOME System Variable and point it to your Maven installation. I pointed mine to C:\apache-maven-3.3.9.


You should now have JAVA_HOME and M2_HOME System Variables.You should now have JAVA_HOME and M2_HOME System Variables.


Add %JAVA_HOME%\bin;%M2_HOME%\bin; to your Path System Variable. This puts your Java and Maven executables in the System Path so that they can be executed without their fully qualified paths.


Open a command prompt window, and at the command prompt, type ‘mvn -version’. You should see a message displaying the version of Maven and the version of Java.


Next, at the command prompt, try typing a command like ‘mvn clean’. You’ll probably see that some jar files downloaded from the Maven central repository to your machine. After that, we see a ‘BUILD ERROR’. This message is fine. This is telling us that we ran the command but that there was no pom.xml file present in the directory where we ran the command.


After running the ‘mvn clean’, if we go to our user home directory (for me, C:\Users\Administrator.SYSTEM-18), we can see that an .m2 directory has been created by maven. Within .m2, we can see a ‘repository’ directory. This is the default location for your local maven repository. This local repository directory contains things such as the jar files that your projects use. In addition, it contains the jar files and things that maven itself needs. When we ran the ‘mvn clean’ command, we asked maven to do a ‘clean’ command, which requires the maven-clean-plugin jar file. If you look back at the command prompt output after the ‘mvn clean’ command, you can see that the maven-clean-plugin jar file was downloaded, since maven realized that it needed this jar file in order to do the ‘clean’.


If we examine the contents of our local maven repository, we can see that it contains the maven-clean-plugin jar file. On my machine, the jar is located at C:\Users\Administrator.SYSTEM-18\.m2\repository\org\apache\maven\plugins\maven-clean-plugin\2.4.1.


Our Maven is installed and working. We can now get to work creating projects with this great tool.

December 31, 2015

1 responses on "What is Maven and how do I install it?"

  1. Ok, so you now have Maven installed and we’re ready to go. Before we jump into our examples we’ll very briefly go over what Maven is and how it can help you with your daily work and collaborative efforts with team members.

Leave a Message

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

About Us

Pradeep Academy is an online & Training institute To make learning easy, interesting, affordable and accessible to millions of learners across the Globe. To create an alternative learning platform, using a unique learning methodology of live online interactive courses along with 24x7 support. We aim to empower our customers with skills which will help them get an edge in their careers and improve their lives.

Contact Us

Address :

#Hosabelaku Building, 3417/13, Near TTMC Bus Stop,, 30 Feet Service Road,

Vijaya Nagar, Bengaluru, Karnataka 560040
Email : [email protected]
Ph No: +91 8660907231
© Pradeep Academy.  Design & Developed by