Linux java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher 运行 bash 文件以构建项目时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6198677/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher when running bash file to build the project
提问by Mahmoud Saleh
hi guys i have maven 2 installed, when i use mvn clean or mvn install in the app root it works fine but when trying to use maven install inside a bash script i got the above exception:
大家好,我已经安装了 maven 2,当我在应用程序根目录中使用 mvn clean 或 mvn install 时它工作正常,但是当尝试在 bash 脚本中使用 maven install 时,我得到了上述异常:
this is my script:
这是我的脚本:
#!/bin/sh
#dirname='/home/myuser/workspace/myapp'
DIRECTORY=$(cd `dirname $ cd $M2_HOME
` && pwd)
cd $DIRECTORY
mvn install -s resources/settings.xml
it was working fine with maven 3, but after i installed maven 2 and configured it, it stopped working and gave me above exception, i don't know what is the problem, since the regular build, mvn install works, but building from the script doesn't work, any ideas ?
它在 maven 3 上工作正常,但是在我安装了 maven 2 并对其进行了配置后,它停止工作并给了我上述异常,我不知道是什么问题,因为常规构建,mvn install 工作,但是从构建脚本不起作用,有什么想法吗?
采纳答案by Raghuram
回答by sourcerebels
I had this issue when my M2_HOME environment variable points to an incorrect location.
当我的 M2_HOME 环境变量指向不正确的位置时,我遇到了这个问题。
Try to:
尝试:
##代码##