1.运行mybatis-generator报错Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.6:generate (default-cli) on project shop: configfile D:\IDEA-workspace\shop\src\main\resources\generatorConfig.xml does not exist
这是指generatorConfig.xml没找到,结果发现是pom文件中配置的地址有问题,从网上粘贴的代码一定仔细检查路径地址,修改后:
2.前面的问题解决了,又报错:<properties> resource generator.properties does not exist
generator.properties的路径也有问题,修改后:
3.第三个报错接踵而至:Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.6:generate (default-cli) on project shop: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.6:generate failed: Exception getting JDBC Driver
原因是pom文件里要把对mysql连接的依赖写在<build>里面</build>,修改后:
4.上面的解决了继续报错:Could not create connection to database server. Attempted reconnect 3 times. Giving up.
原因是少一个参数,设置时区的
解决办法:
jdbc:mysql:
//localhost:3306/x?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
原文:https://www.cnblogs.com/comlee/p/13152346.html