解决IDEA中mybatis-generator插件自动生成代码出现Failed to execute goal org.mybatis.generator:mybatis-generator-m问题

项目场景:

使用mybatis-generator插件逆向生成相关文件出现Failed to execute goal org.mybatis.generator:mybatis-generator-m报错问题


问题描述

Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:
1.3.0:generate (default-cli) on project MyBatis_demo4: The server time zone 
value '�й���׼ʱ��' is unrecognized or represents more than one time zone. 
You must configure either the server or JDBC driver (via the serverTimezone 
configuration property) to use a more specifc time zone value if you want to 
utilize time zone support.

原因分析:

1、mysql6.x版本或以上driverClass需加上.cj

jdbc.driver=com.mysql.cj.jdbc.Driver

2、在generatorConfig.xml配置文件中需要在connectionURL中加入中国标准时间时区信息

jdbc:mysql://localhost:3306/mybatis?serverTimezone=Asia/Shanghai


再次运行mybatis-generator插件就成功啦!

解决IDEA中mybatis-generator插件自动生成代码出现Failed to execute goal org.mybatis.generator:mybatis-generator-m问题_第1张图片

你可能感兴趣的:(后端,maven)