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

第一节搭建环境就出问题了,哪位同学遇到类似问题能够帮忙解决

"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" -Dmaven.multiModuleProjectDirectory=E:\其他\miaoshaproject1 -Dmaven.home=D:\apache-maven-3.6.0 -Dclassworlds.conf=D:\apache-maven-3.6.0\bin\m2.conf "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\lib\idea_rt.jar=63558:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\bin" -Dfile.encoding=UTF-8 -classpath D:\apache-maven-3.6.0\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2020.2 -s D:\apache-maven-3.6.0\conf\settings.xml mybatis-generator:generate

[INFO] Scanning for projects...

[WARNING] 

[WARNING] Some problems were encountered while building the effective model for org.example:miaoshaproject1:jar:1.0-SNAPSHOT

[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: mysql:mysql-connector-java:jar -> duplicate declaration of version 8.0.21 @ line 74, column 19

[WARNING] 

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

[WARNING] 

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

[WARNING] 

[INFO] 

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

[INFO] Building miaoshaproject1 1.0-SNAPSHOT

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

[INFO] 

[INFO] --- mybatis-generator-maven-plugin:1.3.6:generate (default-cli) @ miaoshaproject1 ---

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

[INFO] BUILD FAILURE

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

[INFO] Total time:  1.957 s

[INFO] Finished at: 2020-11-18T23:16:40+08:00

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

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

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

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

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

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

[ERROR] urls[1] = file:/C:/Users/lenovo/.m2/repository/org/mybatis/generator/mybatis-generator-core/1.3.5/mybatis-generator-core-1.3.5.jar

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

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

[ERROR] urls[4] = file:/C:/Users/lenovo/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar

[ERROR] urls[5] = file:/C:/Users/lenovo/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar

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

[ERROR] urls[7] = file:/C:/Users/lenovo/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar

[ERROR] urls[8] = file:/C:/Users/lenovo/.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


提问者:慕姐7096055 2020-11-18 23:20

个回答

  • 手可摘星_陈
    2020-11-26 16:43:57

    dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: mysql:mysql-connector-java:jar -> duplicate declaration of version 8.0.21 @ line 74, column 19

    你试试换个版本  我使用的是8.0.11   但是看问题又说的是重复了