问题描述
我也尝试在终端(Mac OSX)中使用导出命令在.profile文件中设置Maven PATH.但是,在运行mvn命令时,获取-bash:mvn:找不到命令
I tried setting the Maven PATH in .profile file as well using export commands in terminal(Mac OSX). But, on running mvn commands, getting -bash: mvn: command not found
请帮助.
推荐答案
您究竟设置了什么?您是否以这种方式(或类似方式)设置了PATH:
What did you set up exactly? Did you setup PATH like this (or something equivalent):
export PATH=$PATH:...:$M2_HOME/bin
如果是,您是否注销并再次登录?根据bash的联机帮助页:
If yes, did you logout and login again? According to the bash manpage:
如您所见,对于非登录外壳(登录后打开的外壳类型),不会执行.profile
中的命令.因此,您必须注销/登录或手动获取文件源,才能将设置考虑在内.有关更多详细信息,请参见此博客文章.
As you can see, commands from .profile
are not executed for a non-login shell (the type of shells you open after logging in). So you have to logout/login or to source the file manually to take your setup into account. See this blog post for more details.
这篇关于获得-bash:mvn:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!