常见问题集锦 - IDEA

环境配置类

1. lambda expression are not support at language lever 5

<springboot>2.3.6.RELEASE</springboot>
<java.version>1.8</java.version>
<maven >3.6.3</maven >

问题:项目运行编译报错:

lambda expression are not support at language lever 5

原因:是maven编译默认使用的编译器版本是基于java 1.5的,所以在pom.xml中未单独声明maven-compiler-plugin时,对使用了lambda表达式的项目编译就会报错;
解决方法:如下

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>1.8</java.version>
</properties>
...
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<version>3.8.1</version> <!--注意适用版本-->
	<configuration>
		<source>${java.version}</source>
		<target>${java.version}</target>
	</configuration>
</plugin>

PS:直接在IDEA中直接配置的方式也可以解决问题,但是不能根源杜绝问题的发生,不推荐:
在这里插入图片描述
在这里插入图片描述

maven

1. 点击reload all maven project后,maven home directory自动改变

原因:点击reload all maven project后,maven home directory变为C:/Users/xxx/.m2/;
发现原本默认的是从网络获取jre,猜测是因此导致自动更改maven路径去下载所需版本jdk;
解决方法:配置下方标记位即可
在这里插入图片描述

项目运行、打包

1. non-compatible bean definition of same name and class

问题:在更改了目录结构后,挪动了带@Service注解的类,重新打包后启动会报错;

解决方法:

mvn clean	# 清理旧包,防止冲突

# PS:可以去探寻此异常出现的原理

2. Method breakpoints may dramatically slow down debugging

问题:本地运行项目时,启动速度特别慢,近乎停滞状态;(debug窗口会弹窗提醒此信息);
原因:在方法上打断点了(方形);
在这里插入图片描述
解决方法:去掉即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mitays

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值