在Mac上的终端输入命令 mvn clean package -e -U 进行项目的编译时,报错:
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
导致 “BUILD FAILURE”
检查一下 Maven:
➜ ~ mvn -v
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
原来是编辑Java环境变量时 少了个s 啊!
——那么就重新编辑JAVA_HOME 环境变量,使其正确。
而后再次编译Maven项目:mvn clean package -e -U
终于 build Success !!!!!
【Reference】
(帮助找到问题所在:发现mvn运行在jre上,应该运行在JDK上! )
2、Macbook idea:No compiler is provided in this environment. Perhaps you are running on a JRE...
(帮助解决:去环境变量配置文件将JAVA_HOME路径改掉!改为 JDK路径 !)