Search code examples
windowsmavencmdenvironment-variables

mvn' is not recognized as an internal or external command


I have created these variables with their respective values, but even after doing this, command prompt is not recognizing mvn command
System Variables:

  • name: M2_HOME
  • value: C:\Program Files\apache-maven-3.2.1

  • name: M2
  • value: %M2_HOME%/bin;

  • name: path
  • value: %JAVA_HOME%\bin; %M2_HOME%\bin;

Solution

  • From Maven documentation page:

    Maven, like many cross-platform tools, can encounter problems when there are space characters in important pathnames. The instructions below will remind you of this for several particular items.

    You have Maven installed in C:\Program Files\apache-maven-3.2.1

    Try to reinstall it to, for example, C:\maven, or change your current variable M2_HOME to C:\PROGRA~1\apache-maven-3.2.1