idea的language level默认为5的解决方案
更新时间:2025年12月20日 10:17:28 作者:naseng
文章介绍了在IDEA中修改项目语言级别(language level)时遇到的问题,以及解决方法,方法1是通过在父pom文件中添加配置来解决,方法2是修改maven的settings.xml文件
idea的language level默认为5
idea里的language level默认为5,改了project中 的project language level也没用。
基本上处于过两分钟就会有提示告诉你,你刚改的modele language level又自动改回5了,lamda什么的都会编译报错,
方法1:可以在父pom中添加如下配置
<properties>
<!--指定Java版本-->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
方法2:修改maven的settings.xml文件
<profile>
<id>jdk1.8</id>
<activation>
<jdk>1.8</jdk>
<activeByDefault>true</activeByDefault>
</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>
<profile>
<id>alimaven</id>
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/repository/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
Java-URLDecoder、URLEncoder使用及说明
本文介绍了Java中URLDecoder和URLEncoder类的使用方法,包括编码和解码规则、推荐的编码方案、解码器处理非法字符的方法以及URL编码和解码的示例2024-12-12
SpringBoot配置文件中系统环境变量存在特殊字符的处理方式
这篇文章主要介绍了SpringBoot配置文件中系统环境变量存在特殊字符的处理方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2022-02-02


最新评论