mac Maven error No compiler is provided in this environment. Perhaps you are running on a JRE rat

That year - snow in the sky 2022-08-06 17:39:47 阅读数:398


1. The environment variables of java may not be matched,

Reconfigure it

Enter the command: [/usr/libexec/java_home -V] to view the default jdk installation path address (the green underline is the jdk default path) (Note️: The command line terminal is size-sensitiveWrite [-v is wrong, it must be uppercase -V])

vi ~/.bash_profile edit environment variables and add the following commands

JAVA_HOME must fill in its own installation path




export JAVA_HOME

export PATH


Close the terminal, the terminal will automatically save

Enter the command [source .bash_profile] to make the configuration take effect

Enter [echo $JAVA_HOME] to display the path just configured

2. Check IDea configuration

Check the Project SDK and Project language level configured in the project
Detect Preferences | Build, Execution, Deployment
---->Build Tools -> Maven -> Runner -> JRE
---->Compiler -> Java Compiler -> Project bytecode version

3. The configuration fails for some reason

Execute mvn -version to see that the jdk directory specified by maven is not the correct local jdk path;

Try to reload source ~/.bash_profile; after reloading, it is found that the jdk path specified by maven is correct; at this time, the execution of the packaging command still reports an error;

4. It may be that the idea is not loaded, so execute source ~/.bash_profile in the idea console,

copyright:author[That year - snow in the sky],Please bring the original link to reprint, thank you.