I\'ve tried installing Maven to Windows 7 with poor results. Some basic info:
Maven installation directory: C:\\Program Files\\Apache Software Foundation\\ap
set 'M2_HOME' and 'PATH' in environment variables for your account, remove 'PATH' from system environment variables.
Just now I faced the same issue.
In my case the problem was that PATH wasn't set properly to include %M2_HOME%\bin.
Once set properly, the problem was resolved.
When you face such issues, please print the value of PATH on the command line to ensure that it's properly picking up the values.
There could be a possibility of having another version of maven installation at parallel location. In such case remove the unwanted one and reset the appropriate path against M2_HOME.
For me, the PATH variable had old version of maven. So I updated it. I should use %M2_HOME% but I had spelled out the path.
Had an old version of MVN in another directory that showed up in the search path. Removed the old version and everything worked. Used windows file search to scan the drive for all instances of "mvn" to find the old version.
In 3.3.1 *.bat files disappeared and just *.cmd files remained. .CMDs are the same as .BAT and some software expects them. I have renamed .CMDs to .BATs in order make it running under Netbeans. It caused "Maven M2_HOME set to an invalid directory". Copying .BATs to .CMDs (i.e. both were in the folder) solved the problem.