When using IDEA, the default LanguageLevel and JavaCompiler of the imported Maven project are both 1.5. In the case of 1.5, even the simplest @Override
annotation is not supported, so there may be a lot of errors in the project.
Although F4 can modify the LanguageLevel on the project, and the JavaCompiler version can be modified in the settings, but once the Maven project changes and an automatic update occurs, the modifications made here will be in vain. IDEA resets these configurations.
After Google search, I finally found a solution, refer to the following address:
The solution is to specify maven-compiler-plugin
the version in pom.xml, which will affect both LanguageLevel and JavaCompiler. After modification, it will default to the version set here.
Add the following configuration:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
The settings here 1.8
can be modified according to personal needs.