2017-04-04 90 views
2

嘗試安裝到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 

我應該怎麼做才能正確配置它?

+0

刪除MAVEN_HOME變量。只有把它放入PATH veriable ...檢查你的環境中是否有以前安裝的M2_HOME ....如果是這樣刪除它... – khmarbaise

+0

你可以嘗試在你的'MAVEN_HOME'路徑中包括'libexec',我是usinhg mac和它的'/ usr/local/Cellar/maven/3.3.9/libexec'。 –

+0

Java Home應該是JAVA_HOME:'C:\ Program Files \ Java \ jdk1.8.0_101' – kushal

回答

0

enter image description here

Set M2_HOME = <PATH To Maven> 
Set M2=%M2_HOME%\bin 
Add M2 to Path variable 
PATH = ;%M2% 
+0

請在答案中添加更多信息而不是複製/粘貼 –