Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Maven install "'mvn' not recognized as an internal or external command" after setting OS environmental variables?

I've followed the official installation instructions here for Windows XP. But sometimes when I execute mvn --version, I receive the error message,

'mvn' not recognized as an internal or external command

I've even rebooted my machine a couple times, but the OS does not always recognize the maven command. But when I execute either, cd %M2_HOME%, or cd %M2% it brings me to the installation directory. I've also made sure to add the user variable M2 to the Path system variable.

So, what gives?

like image 520
mre Avatar asked Aug 09 '12 18:08

mre


People also ask

Why am getting mvn is not recognized?

mvn -version 'mvn' is not recognized as an internal or external command, operable program or batch file. Answer: Refer to Step 4, make sure the %MAVEN_HOME%\bin is added to the PATH system variable. Answer: Refer to Step 2, make sure JDK is installed and the JAVA_HOME system variable is configured.

Why Maven is not showing in command prompt?

The mvn executable has to be added to your PATH variable. Alternatively you can try starting mvn from its bin-directory as a first test.


2 Answers

Way around would be moving M2 from user variables to system variables

like image 163
Pshemo Avatar answered Oct 14 '22 10:10

Pshemo


Looks like maven is not present in your PATH. Add the absolute maven home\bin location to your PATH.

like image 21
Reimeus Avatar answered Oct 14 '22 09:10

Reimeus