mvn command is not recognized as an internal or external command

前端 未结 22 2299
执念已碎
执念已碎 2020-12-30 19:20

I am getting the mvn command not recognized as an internal or external command.

I have setup the M2_HOME, JAVA_HOME and added %M2_HOME%/bin to the path

相关标签:
22条回答
  • 2020-12-30 19:38

    I also was facing with the same issue still after adding path in environment variable and running it as a normal user in command prompt.

    Then I opened command prompt and tried running as "Run as Administrator" and I was able to download all the packages with respect to the project.

    0 讨论(0)
  • 2020-12-30 19:39

    This is worked for me:

    1-download apache-maven-3.3.9-bin.tar.gz file from https://maven.apache.org/download.cgi

    2-copy the folder under c:\programfiles

    3-set variables as this: M2_HOME ----- C:\Program Files\apache-maven-3.3.9 M2 ----- C:\Program Files\apache-maven-3.3.9

    add Path variable to this: ;C:\Program Files\apache-maven-3.3.9\bin

    then run the cmd as system admin

    it worked.

    0 讨论(0)
  • 2020-12-30 19:39

    Try %M2_HOME%\bin (\ rather than /)

    0 讨论(0)
  • 2020-12-30 19:40

    I have a stupid comment but someone else will have that issue. I was getting that same error when I was trying to put in ./mvnw clean package and I found out that I had to change it a bit to .\mvnw clean packageand I lived happily ever after.

    0 讨论(0)
  • 2020-12-30 19:40

    For me it was not working since I was editing Path variable in "User variable" and adding it under "System variable" made it work. Hope it helps.

    0 讨论(0)
  • 2020-12-30 19:42

    Right click on My Computer >> Properties >> Advanced system settings >> System Properties window will get displayed Under Advanced >> Environment Variables

    Click on New to set Environment Variables

    Variable name: JAVA_HOME Variable value: C:\Program Files\Java\jdk1.8.0_121

    Variable name: M2 Variable value: %M2_HOME%\bin

    Variable name: M2_HOME Variable value: C:\Program Files\Apache Software Foundation\apache-maven-3.5.0

    Variable name: Path Variable value: %M2_HOME%\bin

    Then click on Ok, ok, ok. Now restart you command prompt and check again with “mvn –version” to verify the mvn is running, you may restart your system also.

    It's Working...... Enjoy :)

    Thanks Sandeep Nehte

    0 讨论(0)
提交回复
热议问题