1. During development, the JDK version and Maven version will be switched. If the setting is improper, the JDK will still be the old version when Maven is compiled. This problem is encountered and recorded here.

The diagram below:

Open the Maven Setting window

The fourth image was not set at the time, resulting in maven compiling with an older VERSION of the JDK. Set this up and use your JDK version to compile.

If that still doesn’t work, check the Maven Settings in Setting as well.

(2) Set the Project Settings as follows:

Markup: This figure uses the IDEA2020 version; The earlier version of IDEA was not modified.