idea运行maven install报错:Perhaps you are running on a JRE rather than a JDK?
今天再idea终端里面输入“mvn install -Dmaven.test.skip=true”命令,报错:
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
百度了半天没有找到正确的解决方案,后面自己摸索,应该是idea哪里设置不对,导致maven的运行时环境是jre而不是jdk,所以打开idea的设置界面,全局搜索jre,出现了一个地方,感觉是这里有问题,遂进行修改然后再次再终端输入命令,构建jar包成功。
如下贴出修改步骤:
1、 idea打开设置界面,Preferences | Build, Execution, Deployment | Build Tools | Maven | Runner
2、这里右侧的jre有多个选项,下拉框选择jdk的安装位置,点击apply,保存,重新构建成功。