用 idea 打包时遇到 generatorConfig.xml 会执行,将修改过后的dao和mapper会被覆盖掉问题。

在pom文件<plugin>中generatorConfig.xml设置中添加<phase>deploy</phase>如下:

<executions>
	<execution>
		<id>Generate MyBatis Artifacts</id>
		<!--加入下行打包时不会执行 generatorConfig.xml -->
		<phase>deploy</phase>
		<goals>
		    <goal>generate</goal>
		</goals>
	</execution>
</executions>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.