mybatis逆向工程踩的坑

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连接的依赖不仅要写在<dependencies>里面,还要写在<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
5.第五个报错如期而至:Access denied for user 'root'@'localhost' (using password: YES)
原因是generatorCongfig.xml里jdbcConnection内密码那里缺少一个反大括号“}”
 
最后运行成功!

 

posted @ 2020-06-17 14:41  年轻的农夫yo  阅读(1856)  评论(0)    收藏  举报