M HYPE SPLASH
// news

" maven -version" command is not recognized in Git Bash

By Emma Terry

I am trying to run commands like maven -version,mvn clean install but get the following error:

$ maven -version
bash: maven: command not found

I have all the necessary Environment variables and Paths in place.

6

3 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 recognized

Probably 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%\bin

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.

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy