简体   繁体   English

错误:找不到或加载主类$ MAVEN_HOME

[英]Error: Could not find or load main class $MAVEN_HOME

while running maven clean I am getting the following error : 在运行maven clean时出现以下错误:

Error: Could not find or load main class $MAVEN_HOME 错误:找不到或加载主类$ MAVEN_HOME

while doing mvn -version I got : 在执行mvn -version我得到了:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:4
7+05:30)
**Maven home: D:\mavenSecurity\apache-maven-3.3.9\bin\..**
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_79\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

I have set MAVEN_HOME = D:\\mavenSecurity\\apache-maven-3.3.9 in user variable in environment setting 我在环境设置的用户变量中设置了MAVEN_HOME = D:\\mavenSecurity\\apache-maven-3.3.9

Path in system variable in environment setting : D:\\mavenSecurity\\apache-maven-3.3.9\\bin 环境设置中系统变量的路径: D:\\mavenSecurity\\apache-maven-3.3.9\\bin

Since I am getting other error previously so I have done the following also as mentioned in this post: 由于我之前遇到其他错误,因此我也按照本文中的说明进行了以下操作:

Eclipse error setting up Maven project for class exercise: Check $M2_HOME environment variable and mvn script match Eclipse错误设置Maven项目进行类练习:检查$ M2_HOME环境变量和mvn脚本是否匹配

-Dmaven.multiModuleProjectDirectory=$MAVEN_HOME

I have consulted other links but still I am getting the error while running MAVEN CLEAN in eclipse juno 我已经咨询了其他链接,但是在Eclipse Juno中运行MAVEN CLEAN时仍然出现错误

configuring Maven on Eclipse. 在Eclipse上配置Maven。 you have to tell eclipse where Maven has been installed so that it can use the Maven installation to build our projects. 您必须告诉eclipse Maven的安装位置,以便它可以使用Maven安装来构建我们的项目。

在此处输入图片说明

Win 7 64 . 赢7 64。 Here is how i did my config. 这是我做我的配置的方式。

在此处输入图片说明

This worked for me with the 3.3.9 version. 适用于我的3.3.9版本。 The only difference is : 唯一的区别是:

1) Add both M2_HOME and MAVEN_HOME variables in the Windows environment, and point it to your Maven folder (Note: I have added it to system variables) 1)在Windows环境中同时添加M2_HOMEMAVEN_HOME变量,并将其指向您的Maven文件夹(注意:我已将其添加到系统变量中)

设置环境变量

2) Update PATH variable, append Maven bin folder – %M2_HOME%\\bin , so that you can run the Maven's command everywhere 2)更新PATH变量,追加Maven bin文件夹– %M2_HOME%\\bin ,以便您可以在任何地方运行Maven的命令

Post output of mvn –version again if you face the issue. 如果遇到问题,请再次发布mvn –version输出。 Also try running mvn clean from the command line and post the results. 另外,请尝试从命令行运行mvn clean并发布结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM