Mybatis Generator报错Cannot resolve classpath entry

错误:

E:\Myeclipse\workspace\.metadata\.plugins\org.mybatis.generator.eclipse.ui\.generatedAntScripts\MyBoot-crm-generatorConfig.xml.xml:5: java.lang.RuntimeException: Cannot resolve classpath entry: /MyBoot-crm/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.40-bin.jar
java.lang.RuntimeException: Cannot resolve classpath entry: /MyBoot-crm/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.40-bin.jar

原因:找不到mysql-connector-java-5.1.40-bin.jar文件

解决:找到mysql-connector-java-5.1.40-bin.jar文件(可以WEB-INF/lib下复制)把文件绝对路径填到mybatis-generator配置文件里

<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE generatorConfiguration  
  PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"  
  "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">  
<generatorConfiguration>  
    <classPathEntry  location="E:/MyBoot-crm/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.40-bin.jar"/>  <!--这儿报错 -->
    <context id="DB2Tables"  targetRuntime="MyBatis3">  
        <commentGenerator>  
            <property name="suppressDate" value="true"/>  
            <property name="suppressAllComments" value="true"/>  
        </commentGenerator>  
        <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql:///boot_crm" userId="root" password="xxxx">  
        </jdbcConnection>  
        <javaTypeResolver>  
            <property name="forceBigDecimals" value="false"/>  
        </javaTypeResolver>  
        <javaModelGenerator targetPackage="cn.aynu.crm.po" targetProject="MyBoot-crm">  
            <property name="enableSubPackages" value="true"/>  
            <property name="trimStrings" value="true"/>  
        </javaModelGenerator>  
        <sqlMapGenerator targetPackage="cn.aynu.crm.dao" targetProject="MyBoot-crm">  
            <property name="enableSubPackages" value="true"/>  
        </sqlMapGenerator>  
        <javaClientGenerator type="XMLMAPPER" targetPackage="cn.aynu.crm.dao" targetProject="MyBoot-crm">  
            <property name="enableSubPackages" value="true"/>  
        </javaClientGenerator>  
        <table tableName="customer" domainObjectName="Customer" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
        <table tableName="sys_user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
        <table tableName="base_dict" domainObjectName="BaseDict" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
    </context>  
</generatorConfiguration>  

 

posted @ 2020-05-08 14:05  java从精通到入门  阅读(2947)  评论(0编辑  收藏  举报