错误 也许您在 JRE 上 运行 而不是 JDK?

Error Perhaps you are running on a JRE rather than a JDK?

我尝试 运行 一个项目,但出现此错误。电脑是新的 mac m1,之前这个项目在 windows

RROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project common-core: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debu

在主菜单中的 Intellij 中转到此路径:

File -> Project Structure -> Platform Settings -> SDKs

为了添加新的 JDK 单击 + 按钮并添加 JDK 从您的目录或下载一个新目录。

之后设置项目的 JDK:

File -> Project Structure -> Project Settings -> Project

在此路径中检查 Project SDKProject 语言级别 节。


另外两个重要的设置你应该检查 JDK for Maven that 运行 in Intellij:

第一个:

File -> Settings -> Project -> Build, Execution, Deployment -> Build Tools -> Maven -> Importing

在此路径中检查 JDK for importer 部分。

其次:

File -> Settings -> Project -> Build, Execution, Deployment -> Build Tools -> Maven -> Runner

这里检查 JRE 部分。