mybatisplus代码生成报错
时间: 2023-09-08 17:17:21 浏览: 116
Mybatis批量更新报错问题
在你提供的引用内容中,报错信息是这样的:
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/velocity/context/Context
Caused by: java.lang.ClassNotFoundException: org.apache.velocity.context.Context
这个报错的原因是MyBatis-Plus从3.0.3版本开始移除了代码生成器与模板引擎的默认依赖,所以需要手动添加相关依赖并添加模板引擎依赖。可以在XML文件中加上如下依赖:
```
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
```
其中,mybatis-plus-generator的version需要与你的MyBatis-Plus的版本号保持一致。添加完依赖后,重新运行代码生成器应该就不会再报错了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [使用Mybatis-Plus代码生成器的报错解决](https://blog.csdn.net/XRT_knives/article/details/119617729)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [springboot整合MyBatisplus,实现分页查询、根据表自动生成代码、生成库里所有表对应的代码等功能](https://download.csdn.net/download/qq_33417321/88240573)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文