我遇见的两个问题:执行generator时报错

来源:2-4 Mybatis自动生成器使用方式

卷神一代

2022-03-08 16:43

问题一:

Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate (default-cli) on project miaosha: Unknown system variable 'query_cache_size'


解决一:

如果出现此问题,说明同行者你是在此课程出来后很久才开始学习!

所以只需要改变mysql的版本就可以了,我改成了8.0.27版本

<groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>8.0.27</version>
</dependency>

问题二:

 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.ObjectFactory.addResourceClassLoader(Ljava/lang/ClassLoader;)V

解决二:

将plugins中的下面的依赖,先拿到plugins外面一层,刷新maven,然后放回去,即可解决

<dependency>
  <groupId>org.mybatis.generator</groupId>
  <artifactId>mybatis-generator-core</artifactId>
  <version>1.3.5</version>
</dependency>


写回答 关注

1回答

  • 卷神一代
    2022-03-08 16:45:17

    问题一:

    Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate (default-cli) on project miaosha: Unknown system variable 'query_cache_size'


    解决一:

    如果出现此问题,说明同行者你是在此课程出来后很久才开始学习!

    所以只需要改变mysql的版本就可以了,我改成了8.0.27版本

    <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.27</version>
    </dependency>

    问题二:

     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.ObjectFactory.addResourceClassLoader(Ljava/lang/ClassLoader;)V

    解决二:

    将plugins中的下面的依赖,先拿到plugins外面一层,刷新maven,然后放回去,即可解决

    <dependency>
      <groupId>org.mybatis.generator</groupId>
      <artifactId>mybatis-generator-core</artifactId>
      <version>1.3.5</version>
    </dependency>


SpringBoot构建电商基础秒杀项目

应用SpringBoot快速搭建拥有用户、商品、交易及秒杀活动的电商秒杀应用。

49064 学习 · 954 问题

查看课程

相似问题