When I wanted to enable Maven to run from the command line, I did the following things:
Installation directory:
C:\Software\maven221
System Variables (not user variables):
M2_HOME: C:\Software\maven221
M2: %M2_HOME%\bin
Path: ......;%M2%
The location of the JDK is also in the Path variable.
When I execute: java -version from cmd, it gives me the correct response.
When I execute: mvn --version it says it can not find mvn as a command.
I don’t think that the
M2environment variable is of any use by maven.Just create this environment variable:
And add to the PATH like this: