CCCCCCCYYY_
2018-07-30 01:43
采纳率: 84.2%
浏览 3.9k
已采纳

maven项目mybatis generator运行报错 求帮忙!!

第一次创建maven!!都跟着教程走了!!!这个弹出的错误没搜到!!!求帮忙!!!!!

错误如下:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.392 s
[INFO] Finished at: 2018-07-30T09:24:58+08:00
[INFO] Final Memory: 7M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate (default-cli) on project mavenone: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate failed: A required class was missing while executing org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate: org/mybatis/generator/exception/XMLParserException
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/45392/.m2/repository/org/mybatis/generator/mybatis-generator-maven-plugin/1.3.5/mybatis-generator-maven-plugin-1.3.5.jar
[ERROR] urls[1] = file:/C:/Users/45392/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[2] = file:/C:/Users/45392/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
[ERROR] urls[3] = file:/C:/Users/45392/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[4] = file:/C:/Users/45392/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
[ERROR] urls[5] = file:/C:/Users/45392/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.2/org.eclipse.sisu.inject-0.3.2.jar
[ERROR] urls[6] = file:/C:/Users/45392/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[7] = file:/C:/Users/45392/.m2/repository/org/mybatis/generator/mybatis-generator-core/1.3.5/mybatis-generator-core-1.3.5.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.mybatis.generator.exception.XMLParserException

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

7条回答 默认 最新

  • CCCCCCCYYY_ 2019-08-01 10:48
    已采纳

    呃..jdbc和mysql的版本不匹配导致的

    点赞 打赏 评论
  • melon_jj 2018-07-30 02:03

    generator的配置,还有pom里mybatis-generator的配置 然后才能做出回答

    点赞 打赏 评论
  • mky136 2018-07-30 02:18

    A required class was missing while executing org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate: org/mybatis/generator/exception/XMLParserException

    点赞 打赏 评论
  • l_z_w99 2018-07-30 05:29

    应该是你的配置文件generatorConfig.xml哪里出错了,建议仔细检查一下,比如驱动位置等

    点赞 打赏 评论
  • Super_Mario_Wang 2018-07-30 06:55

    如果你完全按照上面的教程写的,xml在编译器中也没有报错,那就找到你maven库里下载的这个依赖jar目录,org/mybatis 把这下面的下载的东西删掉,重新下载,应该会有帮助

    点赞 打赏 评论
  • melon_jj 2018-07-31 01:44

    图片说明

    点赞 打赏 评论
  • Super .Wein(星痕) 2018-07-31 02:24

    先检查下你的maven pom文件配置是否正确,



    <!-- mybatis 反向工程 mvn -Dmybatis.generator.overwrite=true mybatis-generator:generate -->

    org.mybatis.generator
    mybatis-generator-maven-plugin
    1.3.5

    <!--指定反向工程配置文件路径 -->
    ${basedir}/src/main/resources/generator/generatorConfig.xml
    true
    true



    Generate MyBatis Artifacts

    generate





    org.mybatis.generator
    mybatis-generator-core
    1.3.5





    如果没有问题,接下来检查指定反向工程配置文件格式是否正确,
    <?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">


    <!--关闭注释(生成的文件没有注释) -->


    <!--数据库连接信息(驱动、数据库连接、用户名和密码) -->
    <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://47.105.36.145:3306/dunxin_lms_dev?useUnicode=true&amp;characterEncoding=utf-8"
                    userId="dunxin_lms_dev" password="dunxin_lms@dev">
    </jdbcConnection>
    
    <!--生成的model的包路径和位置 -->
    <javaModelGenerator targetPackage="com.tech.dunxin.lms.system.entity" targetProject="src/main/java">
        <property name="enableSubPackages" value="ture"/>
        <property name="trimStrings" value="true"/>
    </javaModelGenerator>
    
    <!--生成XML映射文件的包名和位置 -->
    <sqlMapGenerator targetPackage="com.tech.dunxin.lms.system.mapperxml" targetProject="src/main/java">
        <property name="enableSubPackages" value="ture"/>
    </sqlMapGenerator>
    
    <!-- 生成的Mapper对象的包名和生成位置 -->
    <javaClientGenerator type="XMLMAPPER" targetPackage="com.tech.dunxin.lms.system.mapper" targetProject="src/main/java">
        <property name="enableSubPackages" value="ture"/>
    </javaClientGenerator>
    
    <!-- 要生成文件的表名,可以指定多个表,domainObjectName为生成文件的前缀,不生成example相关的SQL操作指令,都设置为false -->
    <table tableName="t_email" domainObjectName="Email" enableCountByExample="false" enableUpdateByExample="false"
           enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">
    </table>
    <table tableName="t_sys_role" domainObjectName="SysRole" enableCountByExample="false" enableUpdateByExample="false"
           enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">
    </table>
    


    点赞 打赏 评论

相关推荐 更多相似问题