macOS配置MAVEN环境变量执行source .bash_profile报错.bash_profile: not valid in this context: /xxx/xxx

macOS执行source命令刷新配置文件.bash_profile报错。

添加环境变量之后,执行source .bash_profile刷新配置文件报错

.bash_profile:export:11: not valid in this context: /Library/JavaDevelopment/apache-maven

通过注释测试发现是下面这句在报错

export MAVEN_HOME= /Library/JavaDevelopment/apache-maven

说明是路径有问题,但是各种ls、cd这个路径也没问题,以为是横杠特殊字符,改了之后还是一样的报错。

最后仔细观察,发现MAVEN_HOME=之后居然有个空格。。。删除空格之后再执行source .bash_profile就没问题了。

遇到这种报错,首先考虑引入环境变量的路径是不是有问题,仔细检查。

你可能感兴趣的:(macOS)