I have just installed maven. I downloaded distributive, extracted files and set bin value environment variables, but when I type mvn -version
in CMD I am getting message:
'mvn' is not recognized as an internal or external command,
operable program or batch file.
I am writing project. I have one project DatabaseAPI where I have logic of database and POJO classes. second project is CoreAPI where I have some methods. For DatabaseAPI I make a jar file using eclipse (export -> jar). In core I add external jar (DatabaseAPI.jar). For CoreAPI I make a jar file using eclipse (export -> jar). In core I add external jar (CoreAPI.jar) and I tried to start tomcat (I have servlets in my project and swing too). I got error during starting and error is ClassNotFoundException
(One of the classes in CoreAPI did not find). Is it problem of exporting using Eclipse ?
This command consists of the mvn command which executes Maven, and the build life cycle named clean . This maven command executes the clean build life cycle and the install build phase in the default build life cycle.
There is no default installation location for maven. It is distributed as a zip file. If you're sure you have maven on your machine, you need to search where you extracted it. You should search for "mvn.
To check maven plugin version in eclipse: Click Window –> Preferences –> Maven –> Installation . It will show you installation window with Maven version.
Before moving on, we can check the default JDK version of Maven. Running the mvn -v command will show the Java version in which Maven runs.
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:
Path
ECHO.%PATH:;= & ECHO.%
in cmd to see if you are in this situation). M2_HOME=<your_path>
MAVEN_HOME=%M2_HOME%
MAVEN_BIN=%M2_HOME%\bin
;%MAVEN_BIN%
at the end of the Path
Path
, but you didn't open a new command prompt. Type the command mvn -version
directly in your maven directory, you probably haven't added it to your PATH. Here are explained details of how to add maven to your PATH variable (I guess you use Windows because you are talking about CMD).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With