java 'mvn' 不是内部或外部命令,也不是可运行的程序或批处理文件 (Win10)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33589226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'mvn' is not recognized as an internal or external command, operable program or batch file (Win10)
提问by Feeco
I have read the same questions about this problem but it anywhere not working.
我已经阅读了有关此问题的相同问题,但它在任何地方都不起作用。
I've extracted maven 3.3.3 to D:\Maven (Java already installed and works fine) then added 2 system variables:
我已经将 maven 3.3.3 提取到 D:\Maven (Java 已经安装并且工作正常)然后添加了 2 个系统变量:
M2 - %M2_HOME%\bin M2_HOME - D:\Maven
M2 - %M2_HOME%\bin M2_HOME - D:\Maven
I've also appended next in the path:
我还在路径中添加了 next:
%M2% But it still not working.
%M2% 但还是不行。
I can execute 'mvn -version' from the D:\Maven\bin but can't do this from another directory.
我可以从 D:\Maven\bin 执行 'mvn -version' 但不能从另一个目录执行此操作。
Thanks in advance!
提前致谢!
回答by Bhuwan Prasad Upadhyay
Don't put extra space in your path after D:\Maven\bin; in D:\Maven\bin; D:\Program Files\NodeJS; Please don't make any space in path variable.
不要在 D:\Maven\bin 之后的路径中放置额外的空间;在 D:\Maven\bin 中;D:\Program Files\NodeJS; 请不要在路径变量中留出任何空间。
Normally, To set mvn in command line in windows :
通常,要在 windows 的命令行中设置 mvn :
- Set JAVA_HOME property in system environment
eg.JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
- Set M2_HOME property in system environment
eg.M2_HOME=D:\apache-maven-3.3.3
Finally add maven to PATH
;%M2_HOME%\bin;
add this at the end of PATH property of system environment
- 在系统环境中设置 JAVA_HOME 属性,
例如。JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
- 在系统环境中设置 M2_HOME 属性,
例如。M2_HOME=D:\apache-maven-3.3.3
最后将 maven 添加到 PATH
;%M2_HOME%\bin;
将此添加到系统环境的 PATH 属性的末尾
Now Try mvn -version
现在试试 mvn -version
回答by Rahul Jain
Try to put full maven path upto bin like "C:\Users\ABC\Downloads\maven-2.0.5-bin\maven-2.0.5\bin" directly into path variable of os, then you will be able to understand where problem exists.
尝试将完整的maven路径upto bin像“ C:\Users\ABC\Downloads\maven-2.0.5-bin\maven-2.0.5\bin”直接放入os的路径变量中,然后你就可以理解在哪里问题存在。