使用mybatis-generator插件后的maven打包问题

场景:项目中使用了mybatis-generator插件,在使用mvn package命令打包时,mybatis-generator也会执行,导致在dao中自定义的函数被删除。

原因:是因为mybatis-generator插件默认绑定了package的生命周期

解决:在pom中手动设置一下mybatis-generator插件绑定的生命周期即可

[java]  view plain  copy
  1. <executions>  
  2.     <execution>  
  3.         <id>Generate MyBatis Artifacts</id>  
  4.         <phase>deploy</phase>  
  5.         <goals>  
  6.             <goal>generate</goal>  
  7.         </goals>  
  8.     </execution>  
  9. </executions>  

猜你喜欢

转载自blog.csdn.net/ziwuzhulin/article/details/80252812