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安装的路径,然后选择打勾, 如下图所示。

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?_第1张图片

 

 

引申:

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版本,于系统版本如下,配置内容如下。


    UTF-8
    1.8
    1.8
 

参考:

1.https://stackoverflow.com/questions/19655184/no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-ra

2.https://stackoverflow.com/questions/42525139/maven-build-compilation-error-failed-to-execute-goal-org-apache-maven-plugins

 

你可能感兴趣的:(Eclipse,Maven)