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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM