尝试在Windows中安装maven时,我收到此错误。
我试过的是, 我已将环境变量设置如下:
系统变量:
MAVEN_HOME :: C:\Users\hari\Downloads\apache-maven-3.3.9
用户变量::
PATH : C:\Users\HARI\Downloads\apache-maven-3.3.9\bin;
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_101\jre
cmd中的错误:
C:\Users\hari>mvn -version
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/l
ogging/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
我应该怎样做才能正确配置?
答案 0 :(得分:0)
答案 1 :(得分:0)
你必须设置M2_HOME变量。关注网址http://www.mkyong.com/maven/how-to-install-maven-in-windows/