Fatal error matching: invalid target distribution: 11

Idea executes Maven command and prompts fatal error matching: invalid target distribution: 11

Environmental Science:

        Project JDK version: 11

        Environment variable JDK version: 1.8

        Maven version: 3.3.9

 
Querying the data, we found that when executing the Maven command, we will find the JDK version of the environment variable, so the JDK version does not match the JDK version of the project

Treatment method

1. Before executing the Maven command, execute the command:

set JAVA_HOME=D:\Java\jdk\adopt-openjdk-11.0.11

After execution, execute the Maven command

2. Modify environment variable Java_ Home, configured as jdk11 directory  

Because most of my projects use JDK1.8, only a few projects use jdk11, so I choose to use the first method  

Read More: