I\'ve tried installing Maven to Windows 7 with poor results. Some basic info:
Maven installation directory: C:\\Program Files\\Apache Software Foundation\\ap
In my case the setup was correct:
Windows System Variables:
Windows User variables:
But I had the same problem when there was two installation of maven even though all references was pointing to the latest version which in my case was 3.3.9. After deleting the older version the same command recognised maven.
BEFORE:
maven -v
ERROR: M2_HOME is set to an invalid directory.
M2_HOME = "C:\dev\software\apache-maven-3.3.9"
Please set the M2_HOME variable in your environment to match the
location of the Maven installation
AFTER:
maven -v
Apache Maven 3.3.9
Maven home: C:\dev\software\apache-maven-3.3.9
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_51\jre