No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
问题:
Maven 在Eclipse 中 build 过程遇到 [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
原因:
Eclipse运行环境设置的JRE 而不是 JDK
解决方法:
Window --> Preferences--> Java --> Installed JREs
Add--> 指定到本地JDK安装的路径,然后选择打勾, 如下图所示。
引申:
Maven bulid 出现这个问题:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-cli) on project test-maven: Compilation failure
原因:
Java Build Path 中 JRE配置的版本于系统安装的JRE版本不统一,需要统一。
解决办法:
将工程Java Build Path JRE版本使用本地安装的JRE,
同时配置Maven 的pom.xml 文件中 JRE版本,于系统版本如下,配置内容如下。
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
参考: