Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Maven to the Path variable?

Tags:

I have downloaded the maven 3.5.0 from here. I have set it in the path:

C:\apache-maven-3.5.0 

Then i treid to add it to the path of Windows 7 as below:

  1. Right click on my computer

  2. Properties

  3. Advanced System Setting

  4. Environment Variable

  5. New user variable and added Maven_Home with value C:\apache-maven-3.5.0

  6. Add it to path variable with: %Maven_Home%\bin

  7. Open cmd and ask for mvn -version in desktop

Result:

It does not recognize maven

like image 952
Sal-laS Avatar asked Jul 15 '17 15:07

Sal-laS


People also ask

How do I find the Maven path?

The path of maven should be %maven home%/bin. For example, E:\apache-maven-3.1. 1\bin .

How do I know if Maven is installed on CMD?

Once Maven is installed, you can check the version by running mvn -v from the command-line. If Maven has been installed, you should see something resembling the following output. If you see this output, you know that Maven is available and ready to be used.


2 Answers

In windows:

Download the latest version of Maven from the http://maven.apache.org/ and Navigate to Use --> Download --> Download the Binary zip archive.

1) After the download, unzip the folder and copy it to the folder. (Lets say i have copied to c:\program files\apache-maven-3.52.

2) Setting the path of Maven in environment Variables: Search the Environment Variable --> Edit the System Environment variables--> Navigate to Advanced tab --> Environment Variables

i) MAVEN_HOME : Click New --> Variable Name : MAVEN_HOME , Variable Value: C:\Program Files\apache-maven-3.5.2

ii) M2_HOME : Click New --> Variable Name : M2_HOME , Variable Value: C:\Program Files\apache-maven-3.5.2

iii) Edit the 'Path' Environment Variable --> %M2_HOME%\bin

Testing whether Maven is installed: mvn -version

References:- http://www.baeldung.com/install-maven-on-windows-linux-mac

NOTE : In point iii don't forget to put semicolon(;) before and after.

like image 185
Krishna Avatar answered Sep 27 '22 16:09

Krishna


  1. Open command console
  2. copy this set PATH="c:\program files\apache-maven-3.x.y\bin";%PATH%
  3. cahnge the path accordingly
  4. click enter

it's all set and now check mvn -version

like image 21
user13054935 Avatar answered Sep 27 '22 16:09

user13054935