我尝试对Intellij IDEA进行如下更改:
1。
File >> Settings >> Build, Execution, Deployment >> Compiler >> Java Compiler >> project bytecode version: 1.8 >> Per-module bytecode version: 1.8
2。
File >> Project Structure >> Project Settings >> Project >> SDK : 1.8, Project Language : 8 - Lambdas
File >> Project Structure >> Project Settings >> Modules >> abc : Language level: 8 - Lambdas
但没有任何效果,我将其保存后立即将其版本还原为Java 1.5。
但是,将以下行添加到root(项目级别)pom.xml可以解决上述问题:(两个选项都对我有用)
选项1:
<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
选项2:
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
               
              
File -> Project Structure -> Project :: Project language level改为Diamonds, ARM, multi-catch etc?