MINGW Git bash中的Maven错误:无法找到或加载主类org.codehaus.plexus.classworlds.launcher.Launcher [英] Maven error in MINGW Git bash: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

查看:166
本文介绍了MINGW Git bash中的Maven错误:无法找到或加载主类org.codehaus.plexus.classworlds.launcher.Launcher的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题已经在多个问题中进行了讨论,但是没有答案可以解决我的具体问题.

I'm aware of the fact that this issue has been discussed in several questions but no answer solved my specific issue.

我已经安装了Git bash和Maven,并且正在尝试使用Git bash执行Maven.它因提到的错误而中止.

I have installed Git bash and Maven and I'm trying to execute Maven with Git bash. It aborts with the mentioned error.

我的系统环境:

Windows 7
Git 2.13.3
Maven 3.5.0

必需的用户变量:

HOME=%HOMEPATH%
M3_HOME=%MAVEN_HOME%
MAVEN_HOME=path-with-no-blanks
Path=%MAVEN_HOME%\bin

Maven在Windows命令提示符和Cygwin上运行良好.只有基于MINGW的Git bash失败.

Maven works fine on Windows command prompt and Cygwin. Only MINGW-based Git bash fails.

我在以下位置检查了bash脚本mvn:C:\path\to\maven\bin

I examined the bash script mvn under: C:\path\to\maven\bin

通过设置日志输出并检查MAVEN_HOME值何时丢失,我发现这些语句(甚至是JAVA_HOME)也将其清除:

By setting log outputs and by checking when MAVEN_HOME value gets lost I found out that it gets cleared by these statements (even JAVA_HOME):

# For MinGW, ensure paths are in Unix format before anything is touched !!!HERE MAVEN_HOME value is getting lost!!!
if $mingw ; then
  [ -n "$MAVEN_HOME" ] &&
    MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`(cd "$JAVA_HOME"; pwd)`
  # TODO classpath?
fi

在另一台Windows计算机(Maven和Git的不同版本)上,相同的行略有不同:

On another Windows machine (different version of Maven and Git) the same lines are a bit different:

M2_HOME="`(cd "$MAVEN_HOME"; pwd)`"

代替:

MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`

首先,我认为这是由于引号字符引起的.但是,运行正常的Windows计算机甚至可以与我出现故障的Windows计算机中的新脚本一起很好地运行.我还尝试安装旧的Git或旧的Maven-没有帮助.

First, I thought it's due to the kind of quotation characters. But the working Windows machine even runs well with the new script from my failing Windows machine. I also tried to install the old Git or an older Maven - nothing helps.

为什么提到的bash脚本行清除了MAVEN_HOME变量?

Why does the mentioned bash script line clears the MAVEN_HOME variable?

推荐答案

一段时间以来,我一直得到完全相同的错误,直到我意识到这是由我的防病毒软件(Comodo)引起的.如果我退出/禁用了Comodo,Git bash 甚至将无法正常工作.

I was getting the exact same error for a while until I realized that it was being cause by my antivirus (Comodo). Git bash would not work properly even if I had exited/disabled Comodo.

因此,如果您有Comodo,请尝试按照以下步骤解决该错误(如果您不这样做,则可以尝试使用所使用的任何防病毒/防火墙执行类似的操作):

So if you have Comodo, try following these steps to fix the error (if you don't then maybe try performing something similar with whatever antivirus/firewall you are using):

  1. Comodo->设置->文件评级->添加文件夹(Git文件夹).最终添加了超过5000个受信任的文件(但它有助于解决此问题).

  1. Comodo->Settings->File Rating-> Add Folder (Git Folder). This ended up adding over 5000 trusted files (but it helped fix the issue).

Comodo-> Settings-> Advanced Protection-> Miscellaneous->,并选中不要在...中检测到shellcode注入".我将整个Git文件夹添加到了shellcode注入中.

Comodo->Settings->Advanced Protection->Miscellaneous-> and find the checkmark "Don't detect shellcode injections in...". I added the entire Git Folder to shellcode injections.

我在Comodo-> Settings-> containment->"Auto-containment"中将git文件夹设置为"ignore"

I set the git folder to "ignore" in Comodo->Settings->containment->"Auto-containment"

我要补充一点,我不确定是否需要所有步骤,因此请随意一个接一个地执行它们,看看有什么帮助.

I'll add that I'm not sure if all of the steps are required, so feel free to perform them one by one and see which helps.

这篇关于MINGW Git bash中的Maven错误:无法找到或加载主类org.codehaus.plexus.classworlds.launcher.Launcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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