3

升级IDEA后Lombok不能用了,如何解决?

 3 years ago
source link: https://blog.didispace.com/resolve-lombok-is-disabled/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
升级IDEA后Lombok不能用了,如何解决? | 程序猿DD

升级IDEA后Lombok不能用了,如何解决?

今天到工作室比较晚,在电脑前吃着早饭,看到提示IDEA提示升级,寻思已经有好久没有升过级了。一样等着,就升级下吧。

升级完毕重启之后,突然发现好多错误,原来的应用也没法启动了。仔细一看报错信息,是由于Lombok相关的注解似乎都没有生效。

比如:用到@Slf4j的类里,会有类似这样的报错:

java: 找不到符号  符号:   变量 log  位置: 类 com.didispace.UserService

IDEA还提示,现在使用的编译器不支持lombok

java: You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.  Your processor is: com.sun.proxy.$Proxy26  Lombok supports: sun/apple javac 1.6, ECJ

搜索一番,是由于IDEA版本导致的Lombok失效,不过这个问题后来解决了。所以,我们只需要更新lombok版本,使用1.18.14及之后的版本即可:

<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.14</version> <scope>provided</scope></dependency>

如果是Spring Boot用户,往往不写版本号,因为2.x开始,就Spring Boot就把lombok的版本一起纳入了。有些Spring Boot的老版本就比较容易出现这个问题,比如DD这边出问题的工程就是使用的2.1.3,这里默认引入的lombok版本是1.18.6。



因为Lombok版本低,所以在IDEA升级之后就出了这样的问题。手工维护版本到1.18.14之后,得到解决。


如果上面的办法无法解决你的问题,那么再看看下面这些,或许可以帮你解决问题:







上一篇 下一篇

✕Error. Try later.You have blocked Push Notifications. Follow these instructions to enable Push Notifications.Subscribe to receive push notifications on latest updates第一时间获得DD的最新分享!You are subscribed to Push NotificationsSUBSCRIBE订阅!UNSUBSCRIBE⚡ by  Webpushr

Logo答应我!

好好学习,天天向上!必须的Cookie & Data Storage DetailCookies & Server Data Storage DisclosureBelow are all cookies & data points that will be stored to help us enable web push notifications.Go BackCookies (3)A Cookie is a small piece of data that we will store in your browser.Show cookie info_webpushrPromptActionThis cookie is stored if you do not accept to receive push notifications from us and dismiss this prompt. This helps us remember your decision._webpushrEndPointThis cookie stores a unique URL associated with your push subscription. It is only stored if you accept to receive push notifications from us. This helps us successfully manage and send push notifications to you._webpushrLastVisitThis cookie stores timestamp associated with your last visit on our site. It is only stored if you accept to receive push notifications from us. This helps us successfully manage and send push notifications to you.Server Data Storage (11)Server Data Storage are small data points that will be securely stored by us only if you accept to receive push notifications.Show data infodateTimestamp associated with your push subscription start dateendpointA custom URL and associated encrypted keys pointing to a push server that enable us to send you push notifications.timezoneYour local timezone relative to GMTdevice_typeYour device type. Possible values are Mobile or Desktop.operating_systemYour operating system such as Mac OS, Windows, Android, etc.browserYour browser detail, such as Chrome, Firefox, Opera, Edge, etc.ip_addressYour IP addresscityGeographic Location: CitystateGeographic Location: StatecountryGeographic Location: Countrysession_dateDate corresponding to your last visit on our sitePowered By Webpushr


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK