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.
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.
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
The result of echo $PATH : `$PATH`
– Anit Mohanty Apr 18 '19 at 08:03