Maven project, compile and use idea's compilation function, it is normal, but when executing mvn clean compile in the terminal, an error is reported

1. Background:

Maven project, compile and use idea's compilation function, it is normal, but when executing mvn clean compile in the terminal, an error is reported

Error message:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project xxxx: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Prompts me that there is a problem with the jdk environment

I'll check my jdk environment

Java -version

The Java version can be printed normally,

View JAVA_HOME 

echo $JAVA_HOME 

The path to JAVA_HOME can be printed normally.

There is obviously no problem with my jdk environment variable configuration?

2. Problem causes and solutions

JAVA_HOME is not configured with the real jdk path, although java -version can still display the version.

Solution:

Of course, find the real jdk path and then configure the correct JAVA_HOME

Where is the environment variable path of mac jdk? _Testing Meow Jiang’s Blog-CSDN Blog

Guess you like

Origin blog.csdn.net/qq_39208536/article/details/133805947