Maven – mvn is not recognized after installation Maven 3

mavenmaven-3

I have some problems with my maven 3 installation.

I have downloaded maven 3.0.3 and extracted it to a folder.
I set the following environment variables.

  • M2_HOME:
    C:\a few folders\apache-maven-3.0.3
  • M2:
    %M2_HOME%\bin
  • JAVA_HOME:
    C:\Program Files\Java\jdk1.6.0_25
  • Path:
    %JAVA_HOME%\bin; %M2%

I get a message that the command is not recognized when i type "mvn" in the command line. Any ideas?

Best Answer

Maven 3.0.3 and later doesn't need the M2_HOME variable. The following environment variable changes are sufficient to run Maven from the command-line:

  1. Setting JAVA_HOME to the Java jdk directory (eg. C:\Program Files\Java\jdk1.6.0_29)
  2. Setting PATH to include the Maven bin directory.