0

Getting error while trying to install maven on windows.

What I have tried is, I have set the Environment variables as follows:

System variable::

MAVEN_HOME :: C:\Users\hari\Downloads\apache-maven-3.3.9
User Variable::

PATH : C:\Users\HARI\Downloads\apache-maven-3.3.9\bin;
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_101\jre
ERROR in cmd::

C:\Users\hari>mvn -version

Error:

        Exception in thread "main" java.lang.NoClassDefFoundError: 
        org/codehaus/plexus/logging/LoggerManager

        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
        at java.lang.Class.getMethod0(Class.java:3018)
        at java.lang.Class.getMethod(Class.java:1784)
        at org.codehaus.plexus.classworlds.launcher.Launcher.getEnhancedMainMethod(Launcher.java:172)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:268)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.logging.LoggerManager

    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)


    ... 10 more

what should I do to configure it rightly?

5
  • Which eclipse version you have installed on your windows machine?
    – Bharat Mane
    Commented Apr 12, 2017 at 12:09
  • I cannot see Java in your PATH. Is it mentioned? Commented Apr 12, 2017 at 12:10
  • Using Version: Neon.3 Release (4.6.3)
    – Hari
    Commented Apr 12, 2017 at 12:23
  • Voting to close this question as it is not about testing, but about software development build tools. Better asked and probably already answered on stackoverflow.com Commented Apr 12, 2017 at 12:25
  • Also installing in your download directory doesn't really look like a valid long term strategy. Commented Apr 12, 2017 at 12:26

2 Answers 2

3

Steps to install Maven:

  • Install JDK and add path of JAVA_HOME
  • Download Apache Maven
  • Add M2_HOME and MAVEN_HOME
  • Add To PATH

Modify your System variables: Add both M2_HOME, JAVA_HOME and MAVEN_HOME variables in the Windows environment, and point it to your Maven folder.

MAVEN_HOME :: C:\Users\hari\Downloads\apache-maven-3.3.9

JAVA_HOME : C:\Program Files\Java\jdk1.8.0_101

Take the path up to the JDK only.

Same as MAVEN_HOME add similar path of M2_HOME.

M2_HOME or MAVEN_HOME: Maven document said add M2_HOME only, but some programs still reference Maven folder with MAVEN_HOME, so, it’s safer to add both.

Add To PATH:

Update PATH variable, append Maven bin folder – %M2_HOME%\bin, so that you can run the Maven’s command everywhere.

Still, there is any error refer this link.

0

MAVEN_HOME should probably be M2_HOME: https://stackoverflow.com/questions/23274864/cant-run-maven

As MAVEN_HOME is for Maven version 1: https://stackoverflow.com/questions/17136324/what-is-the-difference-between-m2-home-and-maven-home

Not the answer you're looking for? Browse other questions tagged or ask your own question.