eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

右键 pom.xml -> Run as -> Maven install 后出现类似如下错误:

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

解决方法:

1)选择项目后,点击 eclipse 导航栏中 【Window】-->【Prefrences】-->【Java】-->【Installed JREs】-->Add

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

选择【Standard VM】---> 【Next > 】选择JDK的安装目录确定。

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

 出现如下页面后,点击【Directory ...】选择jdk的安装目录 -->【Finish】

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

最后勾选上 jdk -- > 【OK】

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

2)选择项目后,点击 eclipse 导航栏中 【Project】-->【Properties】-->【Java Build Path】-->【Libraries】

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

 出现如下界面后,双击JRE System Libraries ,选择jdk

 eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

 此时再次执行 Maven install,即可打包成功

eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?