java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher when running bash file to build the project

∥☆過路亽.° 提交于 2019-12-18 05:43:33

问题


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:

this is my script:

#!/bin/sh
#dirname='/home/myuser/workspace/myapp'
DIRECTORY=$(cd `dirname $0` && pwd)
cd  $DIRECTORY
mvn install -s resources/settings.xml $1

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 ?


回答1:


Couple of possibilities...

  • One, as posted here, you have both M2_REPO and M3_REPO variables defined.
  • Or you are facing this issue related to maven3 and M2_HOME
  • The other is that somehow the JRE is getting used instead of JDK when run from the batch file!



回答2:


I had this issue when my M2_HOME environment variable points to an incorrect location.

Try to:

$ cd $M2_HOME


来源:https://stackoverflow.com/questions/6198677/java-lang-noclassdeffounderror-org-codehaus-plexus-classworlds-launcher-launche

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!