这是java home和路径配置。不知道为什么 maven 没有正确检测到 java home。在 MacBook 上通过 sdkman 安装了 java 11 和 maven。谢谢。
m-c02yw:~ vn$ echo $JAVA_HOME
/Users/vn/.sdkman/candidates/java/current
m-c02yw:~ vn$ echo $PATH
/Users/vn/.sdkman/candidates/maven/current/bin:/Users/vn/.sdkman/candidates/java/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/munki
m-c02yw:~ vn$ java -version
openjdk version "11.0.14" 2022-01-18 LTS
OpenJDK Runtime Environment Zulu11.54+23-CA (build 11.0.14+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.54+23-CA (build 11.0.14+9-LTS, mixed mode)
m-c02yw:~ vn$ $JAVA_HOME/bin/javac -version
javac 11.0.14
m-c02yw:~ vn$ mvn -version
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE