mybatis-generator 覆盖新增XML
参考文章:https://www.cnblogs.com/xxoome/p/10068780.html
1.添加依赖(版本1.3.7)
plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.7</version> <configuration> <configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile> <overwrite>true</overwrite> <verbose>true</verbose> </configuration> </plugin>
2.取消注释
<!-- 配置生成器 --> <generatorConfiguration> <properties resource="mybatis/jdbc.properties"/> <context id="MyBatis" targetRuntime="MyBatis3" defaultModelType="flat"> <!-- 不生成注释 --> <commentGenerator> <property name="suppressAllComments" value="true"/> </commentGenerator> ... ... <generatorConfiguration>
3.添加插件
<!-- 配置生成器 --> <generatorConfiguration> <properties resource="mybatis/jdbc.properties"/> <context id="MyBatis" targetRuntime="MyBatis3" defaultModelType="flat"> <!--覆盖生成XML文件--> <plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin" /> <!-- 不生成注释 --> <commentGenerator> <property name="suppressAllComments" value="true"/> </commentGenerator> ... ... <generatorConfiguration>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步