IntelliJ IDEA 源值1.5已过时,将在未来所有版本中删除

原因:
IDEA默认把项目的源代码版本设置为jdk1.5,目标代码设置为jdk1.5

解决方案:

1.修改Maven的Settings.xml文件添加如下内容

<profiles>
        <profile>
            <id>jdk-1.8</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.8</jdk>
            </activation>
            <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
            </properties>
        </profile>
    </profiles>

2.打开项目配置,设置Modules的Language Level为“8”

3.最后按”Ctrl+Alt+S”打开设置,搜索”Java Compiler”,将默认jdk和当前modual的jdk版本切换为1.8即可

猜你喜欢

转载自blog.csdn.net/jyg0723/article/details/73558918