2015 / 20 February

Setting up Maven for Windows/Mac


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)

Windows Users:

  1. Download Apache Maven 3.3.1 from their official site.
  2. Unzip the download contents into a convenient folder : C:\Development\Maven
  3. Now point your PATH variable to Maven’s bin directory. This will allow you to use maven through command prompt when needed
  4. Open console and type: ” set PATH =%PATH%C:\Development\Maven\bin”
  5.  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:

  1. Download the Apache Maven 3.3.1 tar.gz  from their official site.
  2. Extract contents to /usr/local/Maven
  3. Open up Terminal and type the following:
    • touch ~/.bash_profile; open ~/.bash_profile
  4. This should open up a text-file.
  5. Add the following to the end of the file:
    • export PATH=$PATH:/usr/local/Maven/bin
  6. Save the text file and quit Text Edit. (Command+Q)
  7. 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”