0
点赞
收藏
分享

微信扫一扫

【已解决】java.lang.NoClassDefFoundError: orgf4j/LoggerFactory at com.baomidou.mybatisplus.generator

斗米 2022-02-06 阅读 90

当然要发博记录啦,又不是每次都能在一个坑待一天!

 

问题描述:在引用mybatisplus的代码生成器时,报出了这个错误。先看一下我的目录结构

父模块guli_parent下有两个子模块common和service,我在service下建立了他的子模块service_edu,在这个模块下面写业务代码。在他的test里引入mybatisplus的代码生成器,执行以后报了如上错误。

按照全网的方法来看,我是没有引入SLF4J包,于是我在我的依赖中添加了以下代码

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.22</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.22</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.22</version>
</dependency>

 引入这些依赖以后,并没有解决问题(有的小伙伴可能已经解决了)

在删除引用,重新引用,重新下载maven仓库等等一系列的基本操作后,这个报错依然存在。经过长达一天的出坑时间之后,我猛然发现我的maven下service_edu是灰色的。

于是我百度了一下这个问题,打开setting,找到maven,将这个模块取消勾选,模块就被正常引入了。

 

原因可能是复杂的模块之间的操作导致编译器忽略了该模块(我猜的!!!)

希望能帮助到各位在坑里的小伙伴!

 

举报

相关推荐

0 条评论