一、为什么打包时会执行该插件
mybatis-generator-maven-plugin默认绑定了package的生命周期

二、如何解决
如果在package和install 执行插件,修改pom中的配置(黄色部分是修改后的部分,注释部分是之前的,之前的mvn打包有问题)

 

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>mybatis-generator</id>-->
<!-- <goals>-->
<!-- <goal>generate</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<!--<phase>package</phase>-->
<phase>deploy</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
posted on 2019-09-11 16:56  毛会懂  阅读(2453)  评论(0编辑  收藏  举报