无法将mvn命令识别为内部或外部命令 [英] mvn command is not recognized as an internal or external command

查看:636
本文介绍了无法将mvn命令识别为内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到的mvn命令未被识别为内部或外部命令.

I am getting the mvn command not recognized as an internal or external command.

我已经设置M2_HOME,JAVA_HOME并将%M2_HOME%/bin添加到路径变量.所有都是系统变量.仍然遇到同样的问题.

I have setup the M2_HOME, JAVA_HOME and added %M2_HOME%/bin to the path variable. All are system variables. Still getting the same problem.

回显显示正确路径的变量.

Echoing the variables showing me the correct paths.

通往Maven的路径:C:\apache-maven-3.1.0\apache-maven-3.1.0

Path to Maven: C:\apache-maven-3.1.0\apache-maven-3.1.0

M2_HOME:C:\apache-maven-3.1.0\apache-maven-3.1.0

路径:Other things,C:\Program Files (x86)\Java\jdk1.7.0_40\bin,C:\apache-maven-3.1.0\apache-maven-3.1.0\bin

我已经两次重新启动计算机.

and I have restarted my computer twice.

推荐答案

设置M2_HOME后重新启动计算机(指向基于Maven的Mir, c4>目录)和PATH(PATH=%M2_HOME%\bin;%PATH%).

Restart your machine, after setting up your M2_HOME (pointing to you Maven basedir, NOT the bin dir) and PATH (PATH=%M2_HOME%\bin;%PATH%).

然后做:

dir %M2_HOME%\bin\mvn*

如果有一个.bat文件,它应该可以在Windows下运行,因为它似乎可以找到它.如果没有,则您的路径不正确,您需要确保您的%PATH%变量确实指向Maven的正确路径.

If there is a .bat file, it should work under Windows, as it appears to be finding it. If there isn't one, then your paths are not right and you need to make sure your %PATH% variable really points to the correct path to Maven.

确保为您的操作系统使用正确的斜杠.在Windows下,它们是\.

Make sure you are using the proper slashes for your OS. Under Windows they're \.

这篇关于无法将mvn命令识别为内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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