[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin......

孟承嗣
2023-12-01

[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate (default-cli) on project crowdfunding-reverse: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate failed: Exception getting JDBC Driver: com.mysql.jdbc.Driver -> [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/PluginExecutionException

执行mybatis命令的时候出现了这个错误。

解决方法:为generatorConfig.xml添加:

<!-- 最后执行命令:mybatis-generator:generate --> 
<generatorConfiguration>

   <!--添加数据库的连接jar包的位置,在项目的左边最下的external libraries中找到复制全路径-->
    <classPathEntry
            location="C:\Users\Lenovo\.m2\repository\mysql\mysql-connector-java\5.1.25\mysql-connector-java-5.1.25.jar"/>
    <context id="crowdfundingTables" targetRuntime="MyBatis3">

    ............
</generatorConfiguration>

 类似资料: