java.lang.NoClassDefFoundError:运行bash文件构建项目时org/codehaus/plexus/classworlds/launcher/Launcher [英] java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher when running bash file to build the project

查看:257
本文介绍了java.lang.NoClassDefFoundError:运行bash文件构建项目时org/codehaus/plexus/classworlds/launcher/Launcher的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们 我已经安装了maven 2,当我在应用程序根目录中使用mvn clean或mvn install时,它可以正常工作 但是当尝试在bash脚本中使用maven安装时,出现了以上异常:

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:

这是我的脚本:

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

它在Maven 3上运行正常,但是在我安装了Maven 2并对其进行配置后,它停止工作并给了我上述异常,我不知道出了什么问题,因为常规的生成,mvn安装有效,但是从脚本进行构建不起作用,有什么主意吗?

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 ?

推荐答案

可能性的组合...

  • 一个,如此处所述,您已经定义了M2_REPO和M3_REPO变量. /li>
  • 或者您正面临与maven3和M2_HOME相关的问题
  • 另一个是从批处理文件运行时,某种程度上会使用JRE而不是JDK!
  • 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!

这篇关于java.lang.NoClassDefFoundError:运行bash文件构建项目时org/codehaus/plexus/classworlds/launcher/Launcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆