" maven -version" command is not recognized in Git Bash
I am trying to run commands like maven -version,mvn clean install but get the following error:
$ maven -version
bash: maven: command not foundI have all the necessary Environment variables and Paths in place.
63 Answers
Set path as below:
export PATH=$PATH:/c/Program\ Files/Java/jdk1.8.0_221/bin:/c/Program\ Files/apache-maven-3.6.1/bin
mvn -v or mvn --version.
Command is not recognizedProbably you are in one of the following 2 situations:
You didn't add the Maven to the path (run ECHO %PATH% in cmd to see if you are in this situation).
Go to the environment variables and click on New… and add:
M2_HOME=<your_path>
MAVEN_HOME=%M2_HOME%
MAVEN_BIN=%M2_HOME%\binClick 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.
I had the exact same problem.
The solution was to reinstall maven and jdk (I used chocolatey so the paths were automaticly deleted and added again) and simply restart the computer.
Good luck to you all <3