IDEA报错Target level '1.6' is incompatible with source level '1.7'

时间:2023-01-18 23:44:37

解决IDEA 编译级别
Error:java: Target level '1.6' is incompatible with source level '1.7'. A target level '1.7' or better is required

打开之后发现有一个编译级别设置的不对
IDEA报错Target level '1.6' is incompatible with source level '1.7'

更改如下:
IDEA报错Target level '1.6' is incompatible with source level '1.7'

如果上面的方法还是不行的话,就建议你改一下pom文件中的maven插件编译级别,可以通过搜索所有的pom.xml,1.6这个关键词,就看出来了。

    <profiles>
        <profile>
            <id>jdk1.7</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.7</jdk>
            </activation>
            <properties>
                <maven.compiler.source>1.7</maven.compiler.source>
                <maven.compiler.target>1.7</maven.compiler.target>
                <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
            </properties>
        </profile>
    </profiles>