Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij 'mvn' is not recognized as an internal or external command

I have installed maven on my pc and if I type "mvn --version" in the cmd, I get:

Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T14:57:37+03:00)
Maven home: C:\Users\mmmm\Downloads\apache-maven-3.3.3-bin\apache-maven-3.3.3
Java version: 1.8.0_251, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_251\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

The problem is that from Intellij, if I try to do a mvn clean install from the terminal, I get "'mvn' is not recognized as an internal or external command, operable program or batch file."

My system variables contain these:

M2_HOME = C:\Users\mmmm\Downloads\apache-maven-3.3.3-bin\apache-maven-3.3.3
M2 = %M2_HOME%\bin
Path = %M2_HOME%\bin

How can I fix this?

like image 611
Maria1995 Avatar asked Jun 29 '20 13:06

Maria1995


1 Answers

I have also installed JDK 1.8 and Maven3 as below:

>java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

>javac -version
javac 1.8.0_121

>mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\SDK\maven\apache-maven-3.6.3\bin\..
Java version: 1.8.0_121, vendor: Oracle Corporation, runtime: C:\java\jdk1.8\jre
Default locale: en_US, platform encoding: MS932
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

I found the problem is the environment variables of terminal: enter image description here

Copy your bin path of JDK and Maven into it!! And then restart your Terminal.

enter image description here

like image 121
kyakya Avatar answered Nov 09 '22 22:11

kyakya