mybatis generator 运行报错

xml文件配置如下

<?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="/Users/lyv/.m2/repository/mysql/mysql-connector-java/5.1.44/mysql-connector-java-5.1.44.jar" />
    <context id="context" targetRuntime="MyBatis3">
        <property name="javaFileEncoding" value="UTF-8" />
        <!--注释-->
        <!--<commentGenerator type="cn.kelaile.bigdata.common.mybatis.MyCommentGenerator">-->
            <!--&lt;!&ndash; <property name="suppressAllComments" value="true"/> &ndash;&gt;-->
            <!--&lt;!&ndash; <property name="suppressDate" value="true"/> &ndash;&gt;-->
        <!--</commentGenerator>-->
        <!-- 配置路径 -->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
            connectionURL="jdbc:mysql://127.0.0.1:3306/lv?useSSL=false&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;allowMultiQueries=true"
            userId="root" password="123458" />

        <javaModelGenerator targetPackage="com.lyv.springboot.domain"
            targetProject="/Users/lyv/Documents/ideawork/src/main/java" />

        <sqlMapGenerator targetPackage="com.lyv.springboot.mapper"
            targetProject="/Users/lyv/Documents/ideawork/src/main/java" />

        <javaClientGenerator targetPackage="com.lyv.springboot.dao"
            targetProject="/Users/lyv/Documents/ideawork/src/main/java"
            type="XMLMAPPER" />

        <table tableName="customer" mapperName="CustomerDao" domainObjectName="Customer"
               enableCountByExample="false"
               enableUpdateByExample="false" enableDeleteByExample="false"
               enableSelectByExample="false" selectByExampleQueryId="false">
        </table>
            
    </context>
</generatorConfiguration>

运行后报错

[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project springboot-test1: XML Parser Error on line 33: 必须为元素类型 "table" 声明属性 "mapperName"。 -> [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/MojoExecutionException
Disconnected from the target VM, address: '127.0.0.1:52591', transport: 'socket'

Process finished with exit code 1
阅读 5.6k
2 个回答

Mapper.xml bean 和数据库字段写错

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题