Thursday, 25 April 2013

How To Install Maven In Windows 7 64-bit

In today's programming culture it's essential to know some more stuffs apart from the language you code with. I learned the importance of this insight as I was flipping through the book 'Well Grounded Java Developer' . I've come across the title of this book several times only to overlook it meaning  in depth, murmuring 'Ha! another book for java newbie'. But it turned out that I was totally wrong and it taught me a lot about programming (including Java) and other things like test drivent development, build and continuous integration (maven) etc. All these were the buzz terms I've been hearing a lot for the last one year but left unlearned so far. The WGJD was an awesome start-off.

Maven, is one concept I got wrong from the beginning, we've bee using it at our work place as an eclipse plugin for around a year now and I was under the notion that it's 'just a plugin'. Later from the book I understood, maven is a continuous integration tool that's initially run as an application itself via command line and once you get familiar with the cmd usage, you catch up easier with the maven plugins written for IDEs. Below are the ice-breaker steps to get maven running on your windows machine. 


  • Operating System : Windows 7 64 bit
  • Java 1.7 installed and path configured in environment variables

Steps To Install Maven In Windows

1. Download the binary (bin) file of maven from :

2. Extract it to C:\

Note: As in many Java/JVM-related software installations, it pays to not
install Maven into a directory with spaces in its name, because you might
get PATH and CLASSPATH errors. For example, if you're using a MS Windows
operating system, don't install Maven into a directory that looks like C:\Program

3. Add the M2_HOME For Windows-based operating systems, you'll add something like this:

4. Maven needs the Java JDK to run. Any version greater than 1.5 is fine. You'll also need to make sure that your JAVA_HOME environment variable is set—this has probably already been set if you have Java installed. You'll also need to be able to execute Maven-related commands from anywhere in your command line, so you should set the M2_HOME/bin directory to be in your PATH

5. Take the cmd : 

For Windows-based operating systems, you'll need to add this: 


Note that the above lines have to be entered every time when u start cmd to run maven. The best way is to add the property directly in the PATH field in My Computer (Righ Click) >  Properties> Choose Advanced Tab > Environment Variable.

You can now execute Maven (mvn) with its -version parameter to make sure the basic
install has worked.

mvn -version

Why Should I use Maven ? 

Previously, in java projects, when we required the apis from another framework we used to download the jar files from their respective websites and add it to the lib folder in the java project. This is tiresome process, sometimes your newly downloaded jar will have some dependency and need jar's from some other projects to work well. Maven simply automate the major portion of this task by using a pom.xml file. In the pom.xml file you can just specify the name and version of jar files and maven will fetch the same and it's dependencies from the repository. This is the crux of java but there is a lot more you can do from here. 
You can refer the book Well Grounded Java Developer from Manning to learn more about building your project from the pom.xml and doing several other operations.


1. Installing Maven -
2.  Mavens Official Website

3. The Well Grounded Java Developer  ( affiliate link ) 

Get My Next Post In Your Inbox