问答详情
源自:2-4 Mybatis自动生成器使用方式

运行mybatis-generator出错

/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java "-Dmaven.multiModuleProjectDirectory=/Users/wd/Desktop/intershipmanagementsystem-main 2/code/miaosha" -Dmaven.home=/Users/wd/Desktop/apache-maven-3.6.3 -Dclassworlds.conf=/Users/wd/Desktop/apache-maven-3.6.3/bin/m2.conf "-Dmaven.ext.class.path=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven-event-listener.jar" "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=51446:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Users/wd/Desktop/apache-maven-3.6.3/boot/plexus-classworlds.license:/Users/wd/Desktop/apache-maven-3.6.3/boot/plexus-classworlds-2.6.0.jar org.codehaus.classworlds.Launcher -Didea.version=2020.2.3 -s /Users/wd/Desktop/apache-maven-3.6.3/conf/settings.xml mybatis-generator:generate

[INFO] Scanning for projects...

[INFO] 

[INFO] ------------------------< org.example:miaosha >-------------------------

[INFO] Building miaosha 1.0-SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO] 

[INFO] --- mybatis-generator-maven-plugin:1.3.5:generate (default-cli) @ miaosha ---

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  0.585 s

[INFO] Finished at: 2020-11-29T01:31:57+08:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate (default-cli) on project miaosha: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate failed: An API incompatibility was encountered while executing org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate: java.lang.NoSuchMethodError: org.mybatis.generator.internal.util.ClassloaderUtility.getCustomClassloader(Ljava/util/List;)Ljava/lang/ClassLoader;

[ERROR] -----------------------------------------------------

[ERROR] realm =    plugin>org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5

[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

[ERROR] urls[0] = file:/Users/wd/.m2/repository/org/mybatis/generator/mybatis-generator-maven-plugin/1.3.5/mybatis-generator-maven-plugin-1.3.5.jar

[ERROR] urls[1] = file:/Users/wd/.m2/repository/org/mybatis/generator/mybatis-generator-core/1.4.0/mybatis-generator-core-1.4.0.jar

[ERROR] urls[2] = file:/Users/wd/.m2/repository/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar

[ERROR] urls[3] = file:/Users/wd/.m2/repository/com/google/protobuf/protobuf-java/3.11.4/protobuf-java-3.11.4.jar

[ERROR] urls[4] = file:/Users/wd/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar

[ERROR] urls[5] = file:/Users/wd/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar

[ERROR] urls[6] = file:/Users/wd/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar

[ERROR] urls[7] = file:/Users/wd/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.2/org.eclipse.sisu.inject-0.3.2.jar

[ERROR] urls[8] = file:/Users/wd/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar

[ERROR] Number of foreign imports: 1

[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

[ERROR] 

[ERROR] -----------------------------------------------------

[ERROR] 

[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] 

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException


提问者:qq_慕妹3487484 2020-11-29 01:33

个回答

  • Skywalkerywc
    2020-12-22 21:30:57

    mybatis-core版本要和mybatis-maven-plugin版本要一致

  • qq_慕妹3487484
    2020-11-30 12:13:58

    知道了,mybatis-core版本要和mybatis-maven-plugin版本要一致