“Warning:java: 源值1.5已过时, 将在未来所有发行版中删除”报错

3,156 阅读1分钟

使用Maven时,IntelliJ IDEA将默认编译版本和源码版本设置成JDK5,编译项目时会出现警告“Warning:java: 源值1.5已过时, 将在未来所有发行版中删除”,修复该问题的方法如下:

在POM文件中加入下列配置

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

"Ctrl+Shift+Alt+S"打开项目配置,设置Modules的Language Level为"8"

"Ctrl+Alt+S"打开设置,将"Java Compiler"默认jdk和当前module的jdk版本切换为1.8