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?
The accepted answer didn't help but simple step below fix it !
Under system PATH: instead of using M2%, use %M2_HOME%\bin, as simple as that.
N.B my %M2_HOME% is pointing to %MV3_HOME% instead of actual absolute path bcos I have multiple version of maven installed and trying to be clever (switch between maven versions on the same box for different project).
Add your Maven bin path to the System variable as given below
Go to the
or if path is already set than append the path with
";"
restart command and try
I was facing the same issue and then I closed and reopened cmd.exe to get mvn -vto propagate to my command prompt.
If cmd was open when you set the variables they will not be available in that session.
Delete M2 and M2_HOME from user variables and move to system variables. That will solve the problem
Download
apache-maven-3.3.9-bin.zip
file and extract it.Then set system variable
M2_HOME = B:\sql software\apache-maven-3.3.9
or as appropriateAlso set variable
M2 = %M2_HOME%\bin
Open
CMD
and writemvn
I solved thank you
I have got it solved by adding Path variable in user variables as
%JAVA_HOME%\bin;%M2_HOME%\bin;