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?
Looks like maven is not present in your PATH. Add the absolute maven home\bin location to your PATH.
I had similar issue on Windows 7. At first I setup M2, M2_HOME under User variable but when I echoed %PATH% , I did not see maven bin directory listed under PATH. Then I setup M2, M2_HOME under system variable and it worked.
Most probably you may have not installed maven correctly. use this to download maven. Download the latest
(Binary tar.gz)
file.It worked for me.running maven to win 7
You need to set M2 and M2_HOME. I was facing same problem and issue was I had put one extra space in PATH variable after semicolon. Just removed space from path and it worked. (Windows 7 machine)
I've suffered from this problem and found that, for some reason or other, environment variables were simply not being parsed (executing
cd %M2%
told me that there was no folder%M2%
in the current directory). In the end adding the explicit path to Maven's executable worked for me:C:\apache-maven-3.1.0\bin