IDEA下因Lombok插件产生的Library source does not match the bytecode报错问题及解决方法(亲测可用)

来自:互联网
时间:2020-05-26
阅读:

写项目的时候 遇到了个这个问题:Library source does not match the bytecode XXX
然后自己找了找 大部分的解决方法都是没有解决方法 越看心越凉
部分解决方案是清空缓存 试了下并没有什么用
还有些解决方案是用Gradle管理的 而我是用Maven管理的 不太适用
最后然后自己摸索着解决了
由于该问题我已经解决了 无法复现 因而无法截图 就用文字来描述吧:

1、卸载IDEA中的Lombok插件

File-Settings-Plugins 搜索Lombok 然后uninstall卸载

IDEA下因Lombok插件产生的Library source does not match the bytecode报错问题及解决方法(亲测可用)

2、去报错的类(就是上边有一条红色的提示的类) 点击Show diff 打开一个比对窗口

IDEA下因Lombok插件产生的Library source does not match the bytecode报错问题及解决方法(亲测可用)
(这张图是我随便找的 供参考)

3、然后会弹出个窗口 两个文件进行比对 复制报错的该依赖包的路径 然后进入该目录 删除该报错的文件

IDEA下因Lombok插件产生的Library source does not match the bytecode报错问题及解决方法(亲测可用)
(这是我报错的类的目录 仅供参考)

会有.jar.jar.sha1这两个同名的文件 把它们删了 若不放心可进行备份

举个栗子吧 我报错的源文件是spring-data-commons-2.2.6.RELEASE
我就将spring-data-commons-2.2.6.RELEASE-sources.jar和spring-data-commons-2.2.6.RELEASE-sources.jar.sha1删了

4、重新加载Maven

IDEA下因Lombok插件产生的Library source does not match the bytecode报错问题及解决方法(亲测可用)

问题解决

IDEA下因Lombok插件产生的Library source does not match the bytecode报错问题及解决方法(亲测可用)

返回顶部
顶部