mybatis-generator生成文件覆盖问题

在Idea中使用Mybatis-generator plugin时遇到的问题,我的mybatis配置到的DB的服务中,每次部署微服务时需要install db这个微服务,将其打成jar包,供其他服务引用。可是发现,我每次install或者package时候,mybatis-generator都会随编译自动运行,导致工程中的的mapper和dao都被冲掉。

解决方案:


    
    src/main/resources/generatorConfig.xml
    true
    true


    
        Generate MyBatis Artifacts
        
        deploy
        
            generate
        
    


    
        org.mybatis.generator
        mybatis-generator-core
        1.3.2
    

 

官方文档中有如下描述:

The MBG plugin is bound to the generate-sources phase of a Maven build, so it will execute before the compile step. Also note that MBG generates both Java source files and XML resources. The MBG goal will bind both generated Java files and XML resources to the build and they will both be included in any JAR generated by the build.

 

推荐一个牛逼得Java自学网站:http://how2j.cn?p=105437

你可能感兴趣的:(工作中遇到的FAQ)