嘗試安裝到Windows中的maven時出現此錯誤。無法在windows中安裝maven
我曾嘗試是, 我已經設置了環境變量如下:
系統變量:
MAVEN_HOME :: C:\Users\hari\Downloads\apache-maven-3.3.9
用戶變量::在cmd中
PATH : C:\Users\HARI\Downloads\apache-maven-3.3.9\bin;
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_101\jre
ERROR:
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
我應該怎麼做才能正確配置它?
刪除MAVEN_HOME變量。只有把它放入PATH veriable ...檢查你的環境中是否有以前安裝的M2_HOME ....如果是這樣刪除它... – khmarbaise
你可以嘗試在你的'MAVEN_HOME'路徑中包括'libexec',我是usinhg mac和它的'/ usr/local/Cellar/maven/3.3.9/libexec'。 –
Java Home應該是JAVA_HOME:'C:\ Program Files \ Java \ jdk1.8.0_101' – kushal