[英]The java version in “mvn -version” is different from the version in “java -version” for mac
cat /usr/local/Cellar/maven/3.6.3_1/bin/mvn
(maven uses this if present) - not sure if this has anything with homebrew
installed maven.请检查cat /usr/local/Cellar/maven/3.6.3_1/bin/mvn
(如果存在,maven 使用它) - 不确定这是否与安装了homebrew
maven 有任何关系。 If there are any hardcoded versions, it might cause a difference in behavior.如果有任何硬编码版本,则可能会导致行为差异。echo $JAVA_HOME
(maven uses this path and complains if not found) echo $JAVA_HOME
(maven 使用此路径,如果找不到则抱怨)JAVA_HOME
explicitly in any of the terminal sessions?您是否在任何终端会话中明确设置了JAVA_HOME
? Also, how did you install java and maven?另外,您是如何安装 java 和 maven 的? are they both installed using homebrew
?它们都是使用homebrew
安装的吗?
alias java11="export JAVA_HOME=`/usr/libexec/java_home -v 11`"
alias java8="export JAVA_HOME=`/usr/libexec/java_home -v 1.8`"
.bashrc
or .zshrc
这可以添加到.bashrc
或.zshrc
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.