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>

 

posted @ 2019-03-14 15:26  byebai95  阅读(1130)  评论(0编辑  收藏  举报