Reputation: 433
I set the following system veriables (OS = Vista):
M2_HOME = C:\Program Files\Maven
M2 = %M2_HOME%\bin
path = %M2%
If i run mvn -- version I get:
mvn: command not found
Anyone have any idea why this could be? Thanks.
Upvotes: 43
Views: 356148
Reputation: 61
The stupid mistake I made was that I accidentaly downloaded the source zip archive instead of the bin one. So there was no /bin present.
Upvotes: 1
Reputation: 258
sudo apt-get install maven - this made it for me on a vagrant machine with docker installed
Upvotes: 0
Reputation: 622
Follow these steps MAVEN
Again this does not work, hit this command in the Powershell
$env:Path = "$env:Path;C:\path\to\maven\bin"
Make sure to close and reopen the powershell and try mvn -version
Upvotes: 0
Reputation: 428
I think the tutorial passed by @emdhie will help a lot. How install maven
But, i followed and still getting mvn: command not found
I found this solution to know what was wrong in my configuration:
I opened the command line and called this command:
../apache-maven-3.5.3/bin/mvn --version
After that i got the correct JAVA_HOME and saw that my JAVA_HOME was wrong.
Hope this helps.
Upvotes: 1
Reputation: 1666
Maven setup:
a. install maven from https://maven.apache.org/download.cgi
b. unzip maven and keep in C drive.
c. Set MAVEN_HOME in system variable.
Upvotes: 25
Reputation: 379
I followed this tutorial: How to install Maven on Windows
But running mvn -version
, I still got:
mvn: command not found
So, I closed the current git window, and opened a new one. Everything went okay :)
Upvotes: 11
Reputation: 132
I think the problem is with the spaces. I had my variable at the System variables but it didn't work. When I changed variable Progra~1 = 'Program Files'
everything works fine.
M2_HOME C:\Progra~1\Maven\apache-maven-3.1.1
I also moved my M2_HOME
at the end of the PATH(%M2_HOME%\bin)
I'm not sure if this has any difference.
Upvotes: 0
Reputation: 987
I tried solutions from other threads. Adding M2 and M2_HOME at System variables, and even at User variables. Running cmd as admin. None of the methods worked.
But today I added entire path to maven bin to my System variables "PATH" (C:\Program Files (x86)\Apache Software Foundation\apache-maven-3.1.0\bin) besides other paths, and so far it's working good. Hopefully it'll stay that way.
Upvotes: 5
Reputation: 97517
If you are on windows, what i suppose you need to do set the PATH like this:
SET PATH=%M2%
furthermore i assume you need to set your path to something like C:...\apache-maven-3.0.3\ cause this is the default folder for the windows archive. On the other i assume you need to add the path of maven to your and not set it to only maven so you setting should look like this:
SET PATH=%PATH%;%M2%
Upvotes: 7
Reputation: 4732
Upvotes: 0