I have installed a latest maven-3.0.4
on Windows 7:
The installation details are as follows:
Installation Path :
C:\apache-maven-3.0.4
Environment Variables are:
M2_HOME C:\apache-maven-3.0.4\apache-maven\src
JAVA_HOME C:\Program Files\Java\jdk-1.7.0_04
Path variables added are:
%M2_HOME%\bin;%JAVA_HOME%\bin;
In the command window it shows it like this:
C:\>java -version
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b22)
Java HotSpot(TM) Client VM (build 23.0-b21, mixed mode, sharing)
C:\>mvn -version
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
This is the only version on maven installed on my PC and the solution given on many blogs referring to the deletion of the previous M2_HOME
environment variable is not valid.
I have read and tried all the solutions given at blogs such as :
but still not able to get to it. What I might be missing in this whole thing? Thanks in advance.
I had a problem with surefire plugin itself. Going back to version 2.6 worked for me. Version 2.18/20/22.1 gave me the error. Now I tried version 3.0.0-M1 of surefire plugin and it works.
So something is wrong in surefire plgin between version 2.6 and 3.0.0. I assume there is something hardcoded as default which should not.
I had the same issue. I have Windows xp box and when I would type
mvn -version
at the command line prompt I got the dreaded error messageI confirmed that my
M2_HOME
variable was set to the path where Maven was installed on pc and that theecho %path%
confirmed that Maven was in my path.I have been searching for a solution for hours when I stumbled on to my solution (I say my solution because I know this probably won't be the solution for everyone that is getting the same error).
I copied the path that was assigned to my
M2_HOME
variable. I opened a cmd window and typed cd and pasted the path I got from myM2_HOME
variable. At that point I knew that the path was correct because the path was displayed in the window. At this point I entered the dir command and to my surprise, I got the error File Not Found.I went to that path via Explorer and sure enough there were files present. I noticed that the folders were faded out, but I could access them and see the files within each folder (I have admin rights on my pc). I looked at the properties of the parent folder for Maven and saw that the Hidden box was checked. I removed the check and applied and tried my dir command again with success.
Next I tried the
mvn –version
command again, but this time I got back the expected results.Finally I created a jar and war file and my web app ran successfully on my local Tomcat.
I hope this helps some of you out there.
The solution for later versions of Maven is straight-forward. I am on OS X ElCap, 10.11.6 and upgraded to Maven 3.3.9. I had the same problem with error "
Could not find ...org.codehaus.plexus...
". The link provided here offered the solution in a comment by McKamey - simply delete M2_HOME (unset M2_HOME
). Once I tried that, it all worked as expected.This can be confirmed by visiting the
Maven install page
: "Add the bin directory of the created directory apache-maven-3.3.9 to the PATH environment variable" -- no mention of M2_HOME or M3_HOME at all.It look like that you have installed Source files(Because
src
only comes in Source Files and we don't need it). Try to install Binary Files from there. And then set environment variables as described there. This worked for me. And I am sure it will also work for you.I hit this problem too, and found this article. 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. Hope this helps.
Note: Please delete M2_HOME, if already set. Eg:
unset M2_HOME
You should change the location of the M2_HOME into the following:
Furthermore the installation of the JDK looks more a JRE instead of JDK. For Maven you need JDK and NOT JRE.