【MAVEN】编译报错Perhaps you are running on a JRE rather than a JDK?

问题:mvn -e clean package
报错log:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project SecLogProcess: 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]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project SecLogProcess: Compilation failure
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

问题原因:Java有的编译环境中jdk安装与环境变量设置原因,设置了jre的环境但是编译需要JDK的环境
如:
![引用了jre环境【MAVEN】编译报错Perhaps you are running on a JRE rather than a JDK?_第1张图片
JDK的查看path路径设置的对不对,我的原因是因为安装了引用了jre的环境,没有引用jdk。重新设置JDK环境变量 JAVA_HOME 为jdk-14.0.1 或者jdk1.8.0_251即可。
【MAVEN】编译报错Perhaps you are running on a JRE rather than a JDK?_第2张图片

修复完后mvn 编译通过。

你可能感兴趣的:(JAVA)