报错如下:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.001 s
[INFO] Finished at: 2022-05-09T17:15:05+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate (Generate MyBatis Artifacts) on project kpi: Execution Generate MyBatis Artifacts of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate failed: A required class was missing while executing org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate: org/mybatis/generator/internal/NullProgressCallback
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/D:/Java/maven_repository/org/mybatis/generator/mybatis-generator-maven-plugin/1.3.7/mybatis-generator-maven-plugin-1.3.7.jar
[ERROR] urls[1] = file:/D:/Java/maven_repository/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar
[ERROR] urls[2] = file:/D:/Java/maven_repository/com/google/protobuf/protobuf-java/3.11.4/protobuf-java-3.11.4.jar
[ERROR] urls[3] = file:/D:/Java/maven_repository/org/mybatis/generator/mybatis-generator-core/1.4.1/mybatis-generator-core-1.4.1.jar
[ERROR] urls[4] = file:/D:/Java/maven_repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar
[ERROR] urls[5] = file:/D:/Java/maven_repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[6] = file:/D:/Java/maven_repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
[ERROR] urls[7] = file:/D:/Java/maven_repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar
[ERROR] urls[8] = file:/D:/Java/maven_repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[9] = file:/D:/Java/maven_repository/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : org.mybatis.generator.internal.NullProgressCallback
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
找了好久原因,发现是在pom文件里plugin下面多引入了
mybatis-generator-core的 依赖导致;
只需要保留
mysql-connector-java 依赖即可;
注释后修改为如下:
<!--mybatis-generator插件-->
<plugin>
<!--Mybatis-generator插件,用于自动生成Mapper和POJO-->
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<configuration>
<!--配置文件的位置 一定要改成配置文件的位置及名字-->
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<!--mysql driver 插件需要mysql-connector 单独配置的 非项目使用 但尽量与项目一致-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.21</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.mybatis.generator</groupId>-->
<!-- <artifactId>mybatis-generator-core</artifactId>-->
<!-- <version>1.4.1</version>-->
<!-- </dependency>-->
</dependencies>
</plugin>
maybe,是因为mybatis-generator-core.jar这个包里有的类没找到
|