Maven错误:无法找到或加载主类org.codehaus.plexus.classworlds.launcher.Launcher [英] Maven error : Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
问题描述
我已经被这个简单的问题困扰了一个小时. Maven上周工作正常,我不知道出了什么问题会给我这个错误.我尝试了所有的调试方法以及在StackOverflow和其他许多地方找到的所有解决方案.我什至尝试用M3_HOME和MAVEN_HOME替换M2_HOME路径.没事.我在OS X上.以下是一些maven命令的输出.我很乐意提供更多信息
I'd been stuck with this simple issue for an hour now. Maven was working fine last week, I don't know what went wrong it gives me this error. I tried all the ways to debug and all the solutions found in StackOverflow and many other places. I even tried replacing M2_HOME path with M3_HOME and MAVEN_HOME. Nothing worked. I'm on OS X. Below is the output of few maven commands. I'll be happy to provide more information
$ mvn
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
$ which mvn
/Library/Maven-3.3.3/bin/mvn
$ echo $M2_HOME
/Library/Maven-3.3.3
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
$ which java
/usr/bin/java
$ /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Tomcat/bin:/Library/Maven-3.3.3/bin
$ java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
$ ls -lR /Library/Maven-3.3.3
total 56
-rw-r--r--@ 1 USERNAME wheel 19091 Apr 22 04:58 LICENSE
-rw-r--r--@ 1 USERNAME wheel 182 Apr 22 04:58 NOTICE
-rw-r--r--@ 1 USERNAME wheel 2541 Apr 22 04:55 README.txt
drwxr-xr-x@ 8 USERNAME wheel 272 Oct 14 12:24 bin
drwxr-xr-x@ 3 USERNAME wheel 102 Oct 14 12:24 boot
drwxr-xr-x@ 5 USERNAME wheel 170 Apr 22 04:55 conf
drwxr-xr-x@ 75 USERNAME wheel 2550 Oct 14 12:24 lib
/Library/Maven-3.3.3/bin:
total 64
-rw-r--r--@ 1 USERNAME wheel 230 Apr 22 04:58 m2.conf
-rwxr-xr-x@ 1 USERNAME wheel 7075 Apr 22 04:58 mvn
-rw-r--r--@ 1 USERNAME wheel 6007 Apr 22 04:58 mvn.cmd
-rwxr-xr-x@ 1 USERNAME wheel 1796 Apr 22 04:58 mvnDebug
-rw-r--r--@ 1 USERNAME wheel 1513 Apr 22 04:58 mvnDebug.cmd
-rwxr-xr-x@ 1 USERNAME wheel 1843 Apr 22 04:58 mvnyjp
/Library/Maven-3.3.3/boot:
total 104
-rw-r--r--@ 1 USERNAME wheel 52684 Aug 29 2014 plexus-classworlds-2.5.2.jar
/Library/Maven-3.3.3/conf:
total 32
drwxr-xr-x@ 3 USERNAME wheel 102 Apr 22 04:55 logging
-rw-r--r--@ 1 USERNAME wheel 10216 Apr 22 04:55 settings.xml
-rw-r--r--@ 1 USERNAME wheel 3649 Apr 22 04:55 toolchains.xml
/Library/Maven-3.3.3/conf/logging:
total 8
-rw-r--r--@ 1 USERNAME wheel 1126 Apr 22 04:55 simplelogger.properties
/Library/Maven-3.3.3/lib:
total 18656
-rw-r--r--@ 1 USERNAME wheel 136324 Jan 29 2015 aether-api-1.0.2.v20150114.jar
-rw-r--r--@ 1 USERNAME wheel 12637 Apr 22 04:58 aether-api.license
-rw-r--r--@ 1 USERNAME wheel 36745 Jan 29 2015 aether-connector-basic-1.0.2.v20150114.jar
-rw-r--r--@ 1 USERNAME wheel 12637 Apr 22 04:58 aether-connector-basic.license
-rw-r--r--@ 1 USERNAME wheel 172998 Jan 29 2015 aether-impl-1.0.2.v20150114.jar
-rw-r--r--@ 1 USERNAME wheel 12637 Apr 22 04:58 aether-impl.license
-rw-r--r--@ 1 USERNAME wheel 30705 Jan 29 2015 aether-spi-1.0.2.v20150114.jar
-rw-r--r--@ 1 USERNAME wheel 12637 Apr 22 04:58 aether-spi.license
-rw-r--r--@ 1 USERNAME wheel 25355 Jan 29 2015 aether-transport-wagon-1.0.2.v20150114.jar
-rw-r--r--@ 1 USERNAME wheel 12637 Apr 22 04:58 aether-transport-wagon.license
-rw-r--r--@ 1 USERNAME wheel 146876 Jan 29 2015 aether-util-1.0.2.v20150114.jar
-rw-r--r--@ 1 USERNAME wheel 12637 Apr 22 04:58 aether-util.license
-rw-r--r--@ 1 USERNAME wheel 4467 May 7 2013 aopalliance-1.0.jar
-rw-r--r--@ 1 USERNAME wheel 44908 May 7 2013 cdi-api-1.0.jar
-rw-r--r--@ 1 USERNAME wheel 21837 Apr 22 04:58 cdi-api.license
-rw-r--r--@ 1 USERNAME wheel 41123 May 7 2013 commons-cli-1.2.jar
-rw-r--r--@ 1 USERNAME wheel 173587 May 7 2013 commons-io-2.2.jar
-rw-r--r--@ 1 USERNAME wheel 284220 May 7 2013 commons-lang-2.6.jar
drwxr-xr-x@ 3 USERNAME wheel 102 Apr 22 04:55 ext
-rw-r--r--@ 1 USERNAME wheel 2256213 Nov 1 2014 guava-18.0.jar
-rw-r--r--@ 1 USERNAME wheel 2497 May 7 2013 javax.inject-1.jar
-rw-r--r--@ 1 USERNAME wheel 293671 Jul 24 2013 jsoup-1.7.2.jar
-rw-r--r--@ 1 USERNAME wheel 3449 Apr 22 04:58 jsoup.license
-rw-r--r--@ 1 USERNAME wheel 5848 May 7 2013 jsr250-api-1.0.jar
-rw-r--r--@ 1 USERNAME wheel 18116 Apr 22 04:58 jsr250-api.license
-rw-r--r--@ 1 USERNAME wheel 66349 Apr 22 04:57 maven-aether-provider-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-aether-provider.license
-rw-r--r--@ 1 USERNAME wheel 55090 Apr 22 04:56 maven-artifact-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-artifact.license
-rw-r--r--@ 1 USERNAME wheel 14964 Apr 22 04:56 maven-builder-support-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-builder-support.license
-rw-r--r--@ 1 USERNAME wheel 286726 Apr 22 04:58 maven-compat-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-compat.license
-rw-r--r--@ 1 USERNAME wheel 631881 Apr 22 04:57 maven-core-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-core.license
-rw-r--r--@ 1 USERNAME wheel 86051 Apr 22 04:58 maven-embedder-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-embedder.license
-rw-r--r--@ 1 USERNAME wheel 160817 Apr 22 04:56 maven-model-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 176410 Apr 22 04:56 maven-model-builder-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-model-builder.license
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-model.license
-rw-r--r--@ 1 USERNAME wheel 46099 Apr 22 04:56 maven-plugin-api-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-plugin-api.license
-rw-r--r--@ 1 USERNAME wheel 25957 Apr 22 04:57 maven-repository-metadata-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-repository-metadata.license
-rw-r--r--@ 1 USERNAME wheel 43032 Apr 22 04:57 maven-settings-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 43154 Apr 22 04:57 maven-settings-builder-3.3.3.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-settings-builder.license
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 maven-settings.license
-rw-r--r--@ 1 USERNAME wheel 375267 Feb 20 2015 org.eclipse.sisu.inject-0.3.0.jar
-rw-r--r--@ 1 USERNAME wheel 12637 Apr 22 04:58 org.eclipse.sisu.inject.license
-rw-r--r--@ 1 USERNAME wheel 205404 Feb 20 2015 org.eclipse.sisu.plexus-0.3.0.jar
-rw-r--r--@ 1 USERNAME wheel 12637 Apr 22 04:58 org.eclipse.sisu.plexus.license
-rw-r--r--@ 1 USERNAME wheel 13350 May 7 2013 plexus-cipher-1.7.jar
-rw-r--r--@ 1 USERNAME wheel 21837 Apr 22 04:58 plexus-cipher.license
-rw-r--r--@ 1 USERNAME wheel 4211 May 7 2013 plexus-component-annotations-1.5.5.jar
-rw-r--r--@ 1 USERNAME wheel 62458 Oct 29 2014 plexus-interpolation-1.21.jar
-rw-r--r--@ 1 USERNAME wheel 28555 May 7 2013 plexus-sec-dispatcher-1.3.jar
-rw-r--r--@ 1 USERNAME wheel 21837 Apr 22 04:58 plexus-sec-dispatcher.license
-rw-r--r--@ 1 USERNAME wheel 243128 Oct 29 2014 plexus-utils-3.0.20.jar
-rw-r--r--@ 1 USERNAME wheel 399672 Feb 20 2015 sisu-guice-3.2.5-no_aop.jar
-rw-r--r--@ 1 USERNAME wheel 26084 Jul 24 2013 slf4j-api-1.7.5.jar
-rw-r--r--@ 1 USERNAME wheel 14853 Apr 22 04:58 slf4j-api.license
-rw-r--r--@ 1 USERNAME wheel 10680 Aug 17 2013 slf4j-simple-1.7.5.jar
-rw-r--r--@ 1 USERNAME wheel 14853 Apr 22 04:58 slf4j-simple.license
-rw-r--r--@ 1 USERNAME wheel 11432 Apr 21 06:27 wagon-file-2.9.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 wagon-file.license
-rw-r--r--@ 1 USERNAME wheel 2259073 Apr 21 06:32 wagon-http-2.9-shaded.jar
-rw-r--r--@ 1 USERNAME wheel 11787 Apr 21 06:27 wagon-http-shared-2.9.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 wagon-http-shared.license
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 wagon-http.license
-rw-r--r--@ 1 USERNAME wheel 53543 Apr 21 06:27 wagon-provider-api-2.9.jar
-rw-r--r--@ 1 USERNAME wheel 11358 Apr 22 04:58 wagon-provider-api.license
/Library/Maven-3.3.3/lib/ext:
total 8
-rw-r--r--@ 1 USERNAME wheel 152 Apr 22 04:55 README.txt
推荐答案
请删除M2_HOME作为环境变量,它已经由 mvn脚本.您唯一需要做的就是:添加 apache-maven-3.x.x/bin到您的路径,将JAVA_HOME设置为环境 多变的.因此,无需在您的路径中添加%JAVA_HOME%/bin
Please remove M2_HOME as environment variable, it is already set by the mvn script. The only things you need to do is: add apache-maven-3.x.x/bin to your path, set JAVA_HOME as environment variable. So no need to add %JAVA_HOME%/bin to your path
首先尝试从/Library/Maven-3.3.3/bin/文件夹运行mvn -v到 确认安装正确.尝试使用xtrace信息运行mvn (tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html)并验证 Maven建立的命令行.我想你会意外 类路径参数值.
Try to run mvn -v from /Library/Maven-3.3.3/bin/ folder first to confirm the installation is correct. Try to run mvn with xtrace info (tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html) and verify the commandline built up by Maven. I assume you get an unexpected classpath argument value.
这篇关于Maven错误:无法找到或加载主类org.codehaus.plexus.classworlds.launcher.Launcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!