Problems setting up Maven

63,755

Solution 1

Check that you don't have an M2_HOME environment variable.

Solution 2

I ended up on this question with the same problem, however, I had committed an elementary mistake of downloading the apache-maven-..*-src.zip instead of the apache-maven-..*-bin.zip

Once I realised that mistake, it was smooth sailing as soon as I corrected it. I suppose the instructions on the download page should be more than adequate

Solution 3

All you should need to do to install and use maven:

1) Download maven 3. The ZIP should be fine. Install it in a known place; I use c:\tools\ as the parent directory but your mileage may vary.

2) Set your PATH to point to the bin directory in the installation directory. If Maven is in c:\tools\maven-3.0.3 (as it is on my system), you'd add c:\tools\maven-3.0.3\bin to PATH:

set PATH=%PATH%;c:\tools\maven-3.0.3

You may also want to set MVN_HOME:

set MVN_HOME=c:\tools\maven-3.0.3

3) start a new command shell (cmd.exe). mvn should work; if not, you've skipped something here or something's badly wrong in your configuration.

Solution 4

blanking out M2_HOME worked for me on Ubuntu. Can test with just: 'export M2_HOME='

Solution 5

Your first problem is because you do not have maven in your PATH. The second problem is what I had. I had both Maven 2 and 3 on my computer and even though I removed Maven 2 links from my PATH, it was still interfering with my new Maven.

You need to remove or rename the system variable M2_HOME. 1. Right click My Computer -> Properties 2. Advanced system settings 3. Environment Variables 4. Rename or delete M2_HOME

Share:
63,755
Admin
Author by

Admin

Updated on July 25, 2022

Comments

  • Admin
    Admin almost 2 years

    I am having difficulties installing Maven.

    I have set all the enviromental variables according to this: http://maven.apache.org/download.html

    Although I am using windows 7, when I try and run the command mvn --version, I get, mvn is not recognized as an internal or external command etc.

    When I run it from within src\bin, I get the error:

    Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher 
    at java.net.URLClassLoader$1.run<URLClassLoader.java:202>
    at java.security.AccessController.doPrivleged(Native Method) 
    ...etc
    

    then:

    Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher.