我是靠谱客的博主 如意咖啡豆,这篇文章主要介绍ant构建项目迁移到gradle_SpringBoot 2.4.0 Gradle构建系列之二SpringBoot 2.4.0 Gradle中使用MyBatis Generator自动生成代码随着SpringBoot2.4.0的发布,构建工具由Maven转向Gradle,项目采用Grale构建后,MyBatis Generator插件亦需重新折腾,MyBatis Generator是一个mybatis工具项目,用于生成Mybatis的Model、Mapper、Dao持久层的代码。MyBatis G,现在分享给大家,希望可以做个参考。
SpringBoot 2.4.0 Gradle中使用MyBatis Generator自动生成代码
编者: wRitchie(吴理琪) 来源:http://www.bj9420.com
随着SpringBoot2.4.0的发布,构建工具由Maven转向Gradle,项目采用Grale构建后,MyBatis Generator插件亦需重新折腾,MyBatis Generator是一个mybatis工具项目,用于生成Mybatis的Model、Mapper、Dao持久层的代码。MyBatis Generator提供Maven plugin、Ant task、Java三种方式运行。构建工具采用Gradle,虽然MyBatis Generator没有提供Gradle的插件,但Gradle可以调用Ant任务,因此,Gradle能运行Mybatis Generator。
一、 mybatis-dev.properties配置文件
二、 generatorConfig.xml配置文件
三、 添加依赖, build.gradle配置文件:
1、添加mybatisGenerator
2、添加依赖,注意把前面的compile group改为第一步添加的mybatisGenerator
3、添加任务
四、 运行
1、在Gradle中刷新,点开module下的other里找到mybatisGenarate
2、双击mybatisGenarate,自动生成Model、Mapper、Dao成功:
3、生成代码结构:
至此,SpringBoot 2.4.0 Gradle中使用MyBatis Generator自动生成代码配置完毕。
最后
以上就是如意咖啡豆最近收集整理的关于ant构建项目迁移到gradle_SpringBoot 2.4.0 Gradle构建系列之二SpringBoot 2.4.0 Gradle中使用MyBatis Generator自动生成代码随着SpringBoot2.4.0的发布,构建工具由Maven转向Gradle,项目采用Grale构建后,MyBatis Generator插件亦需重新折腾,MyBatis Generator是一个mybatis工具项目,用于生成Mybatis的Model、Mapper、Dao持久层的代码。MyBatis G的全部内容,更多相关ant构建项目迁移到gradle_SpringBoot内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复