[Solved] java: Compilation failed: internal java compiler error

Idea version 2121.2.1

1. JDK configuration problem

Setting project jdk

Setting module jdk

During the setting of compiler jdkthe clean operation was performed after several settings, resulting in @override error. Later, it was found that the compiler was not checked

use compiler from module target JDK when possible

2. Add in POM file

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Done!

Read More: