For Maven3, changing my environment variable name from M2_HOME to M3_HOME did the trick. I am on a Mac running OSX 10.9 with JDK 1.7.
Please remove M2_HOME as environment variable, it is already set by the mvn script. The only things you need to do is: add apache-maven-3.x.x/bin to your path, set JAVA_HOME as environment variable. So no need to add %JAVA_HOME%/bin to your path
Try to run mvn -v from /Library/Maven-3.3.3/bin/ folder first to confirm the installation is correct. Try to run mvn with xtrace info (tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html) and verify the commandline built up by Maven. I assume you get an unexpected classpath argument value.
EDIT : Note this is for Mac users
M2_HOME needs to be removed from the
PATH. By default, your
PATH might be picked up from one of the following files (for me, it was in
It might look something like this:
M2_HOME variables, and any dependencies (in the example, the
M2 variable uses
M2_HOME, so remove that, and the line after which uses
$M2) where ever it shows up.
Just to give more info on how this file is used, you can keep appending whatever location you want to include in the path
For instance, if you want to include
/User/batman/google-sdk into path, then adding the below line to the end of the file will append
/Users/batman/google-sdk (in your case whatever the location of the folder is), to the PATH.
But make sure the
PATH already has some info before the above line.