Shorter
mvn -v
or
mvn --version
Output:
Apache Maven 3.0.5 (...)
Maven home: ...
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: ...
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
The other command (mvn -version
) works because it starts with mvn -v
.
You can also try mvn -v123
and you'll get the same output.
Details:
mvn -h
or
mvn --help
Output:
...
-V,--show-version Display version information
WITHOUT stopping build
-v,--version Display version information
Command is not recognized
Probably you are in one of the following 2 situations:
- You didn't add the Maven to the
Path
(run ECHO.%PATH:;= & ECHO.%
in cmd to see if you are in this situation).
- go to Control PanelUser AccountsUser Accounts
(or click on your photo from the start menu)
- click Change my environment variables
- click on New... and add:
M2_HOME=<your_path>
MAVEN_HOME=%M2_HOME%
MAVEN_BIN=%M2_HOME%in
- click on Edit... and add the
;%MAVEN_BIN%
at the end of the Path
- You added it to the
Path
, but you didn't open a new command prompt.
- open a new command prompt, because the environment variables are not updated automatically
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…