目录
原因:easyexcel和cglib版本不兼容或者没有安装cglib
报错com.alibaba.excel.exception.ExcelGenerateException: java.lang.NoClassDefFoundError: net/sf/cglib/beans/BeanMap$Generator
原因:easyexcel和cglib版本不兼容或者没有安装cglib
解决:在pom中添加对应的cglib依赖
快速找到easyexcel和cglib对应版本
在IDEA下载maven helper插件,用于找到包的冲突和快速检索所有包
maven helper插件简单介绍:
包冲突例如:
表示使用的cglib是3.1版本,但与easyexcel3.0.5版本冲突,兼容的cglib版本是3.3.0
回归正题。直接在pom添加easyexcel依赖,就会自动嵌入cglib,但不会显示。然后在maven helper检索cglib版本,就能找到对应版本,如果没有或者不兼容,也添加cglib对应依赖即可
<!--EasyExcel-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.5</version>
</dependency>
<!--cglib-->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.3.0</version>
</dependency>
cglib可能被排除了