问题描述
在IntelliJ中使用Maven时,IDEA将默认的编译版本、源码版本设置为jdk5。编译项目的时候出现以下警告:
“Warning:java: 源值1.5已过时, 将在未来所有发行版中删除”
如图所示:
解决方法
(1)修改Maven插件的默认配置
在”pom.xml”里加入如下代码:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
(2)修改Intellij的Java编译器版本
File=》Setting...
,直接搜Java Compiler
,然后将对应项目的Target bytecode version改为1.8。
(3)修改项目本身的Java编译器版本
File=》Project Structure...=》Modules
,将Sources
下的Language level
改为8。
OK!