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.
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%
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.
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 :)
Maven setup:
a. install maven from https://maven.apache.org/download.cgi
b.unzip maven and keep in C drive.
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.
mvn -version
export PATH=$PATH:/opt/apache-maven-3.6.0/bin
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.