Issue
I have read similar questions about this problem but it is not working anyways.
I've extracted maven 3.3.3 to D:\Maven (Java already installed and works fine) then added 2 system variables:
Variable | Value |
---|---|
M2 |
%M2_HOME%\bin |
M2_HOME |
D:\Maven |
I've also appended next in the path:
%M2%
But it is still not working.
I can execute mvn -version
from the D:\Maven\bin
but can't do this from another directory.
Solution
Don't put extra space in your path after D:\Maven\bin; in D:\Maven\bin; D:\Program Files\NodeJS; Please don't make any space in path variable.
Normally, To set mvn in command line in windows :
- Set JAVA_HOME property in system environment
eg.JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
- Set M2_HOME property in system environment
eg.M2_HOME=D:\apache-maven-3.3.3
Finally add maven to PATH
;%M2_HOME%\bin;
add this at the end of PATH property of system environment
Now Try mvn -version
Answered By - Bhuwan Prasad Upadhyay