I’m going to assume you have JDK installed already. Make sure your path is set correctly Command Prompt/Terminal –> Type “java -version”. You should see something like this:
java version “1.7.0_75”
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
- Download Apache Maven 3.3.1 from their official site.
- Unzip the download contents into a convenient folder : C:\Development\Maven
- Now point your PATH variable to Maven’s bin directory. This will allow you to use maven through command prompt when needed
- Open console and type: ” set PATH =%PATH%C:\Development\Maven\bin”
- Alternatively you can do the following:
- Open Windows Explorer –> Right Click on My Computer –> Properties –> Advanced System Settings
- Advanced Tab –> Environment Variables (Should be at the bottom )
- Now under the USER VARIABLES, edit the PATH variable. If it doesn’t exist yet, create it: New –> Variable Name : “PATH”
- Set/Edit value : “%PATH%;C:\Development\Maven\bin (If you’re editing it, it should look something like this : %PATH%;C:\somePath\someBin;C:\Development\Maven\bin)
Mac OS/Linux Users:
- Download the Apache Maven 3.3.1 tar.gz from their official site.
- Extract contents to /usr/local/Maven
- Open up Terminal and type the following:
- touch ~/.bash_profile; open ~/.bash_profile
- This should open up a text-file.
- Add the following to the end of the file:
- export PATH=$PATH:/usr/local/Maven/bin
- Save the text file and quit Text Edit. (Command+Q)
- In your terminal type “source ~/.bash_profile to re-run the profile you just edited.
That’s it! Open up a new terminal or command prompt and check if maven is installed by typing:
- “mvn –version”