web项目使用到mybatis,需要使用mybatis的自动生成代码插件,配置build部分如下:
1 <build> 2 <pluginManagement></pluginManagement> 3 <plugins> 4 <plugin> 5 <artifactId>maven-war-plugin</artifactId> 6 </plugin> 7 <plugin> 8 <artifactId>maven-compiler-plugin</artifactId> 9 <configuration> 10 <source>1.6</source> 11 <target>1.6</target> 12 </configuration> 13 </plugin> 14 <plugin> 15 <groupId>org.mybatis.generator</groupId> 16 <artifactId>mybatis-generator-maven-plugin</artifactId> 17 <version>1.3.2</version> 18 <executions> 19 <execution> 20 <id>mapper-generate</id> 21 <phase>generate-resources</phase> 22 <goals> 23 <goal>generate</goal> 24 </goals> 25 </execution> 26 </executions> 27 <dependencies> 28 <dependency> 29 <groupId>org.mybatis.generator</groupId> 30 <artifactId>mybatis-generator-core</artifactId> 31 <version>1.3.2</version> 32 </dependency> 33 </dependencies> 34 <configuration> 35 <verbose>true</verbose> 36 <overwrite>true</overwrite> 37 <configurationFile>src\main\resources\generatorConfig.xml</configurationFile> 38 </configuration> 39 </plugin> 40 </plugins> 41 </build>
execution标签处报错详细如下:
报错内容:
Plugin execution not covered by lifecycle configuration: org.mybatis.generator:mybatis-generator-maven-
plugin:1.3.2:generate (execution: mapper-generate, phase: generate-resources)
解决方法:
<plugins> 标签外再套一个 <pluginManagement> 标签 解决
时间: 2024-10-05 23:26:59