java - Mybatis Generator代码不报错,但是没有生成文件
PHP中文网
PHP中文网 2017-04-18 09:46:16
0
3
1034

代码不报错,但是就是无法生产对应文件?
大家有遇到的吗?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
PHPzhong

Usually when I encounter this kind of problem, it’s because the path I set is wrong and the generation is somewhere else. You can also check whether the runtime console prints the save...file to where it is.

迷茫

Go directly to the code, this is the configuration file, specify your generation path. Then in the directory, execute the command: mvn mybatis-generator:generate

<?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>
    <!-- oracle-connector的位置 -->
    <classPathEntry
        location="D:/myproject/.m2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar" />

    <!-- 配置一个代码生成操作,如果生成的目录或是数据库不一样,只需要参考增加一个context节点即可 -->
    <context id="rock_auth_app_sys" targetRuntime="MyBatis3">

        <property name="suppressAllComments" value="true" />
        <property name="useActualColumnNames" value="false" />
        <!-- 配置插件 -->
        <plugin
            type="com.rock.dal.mybatis.MysqlPaginationPlugin" />

        <jdbcConnection driverClass="org.gjt.mm.mysql.Driver"
            connectionURL="jdbc:mysql://10.101.234.27:3308/idcm" userId="数据库用户名"
            password="数据库密码">
        </jdbcConnection>

        <javaTypeResolver>
            <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>

        <!-- mvn mybatis-generator:generate -->
        <!-- 配置model生成位置 -->
        <javaModelGenerator targetPackage="com.alibaba.tboss.dal.mysql.workOrder"
            targetProject="src/main/java">
            <property name="enableSubPackages" value="true" />
            <property name="trimStrings" value="true" />
        </javaModelGenerator>

        <!-- 配置sqlmap生成位置 -->
        <sqlMapGenerator targetPackage="com.alibaba.tboss.dal.mysql.workOrder.mapper"
            targetProject="src/main/resources">
            <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>

        <!-- 配置mapper接口生成位置 -->
        <javaClientGenerator type="XMLMAPPER"
            targetPackage="com.alibaba.tboss.dal.mysql.workOrder.mapper" targetProject="src/main/java">
            <property name="enableSubPackages" value="true" />
        </javaClientGenerator>

        <!-- mvn mybatis-generator:generate -->
    
        <table schema="idcm" tableName="idc_logistics_assign_rules" domainObjectName="LogisticsAssignRules"
            enableUpdateByExample="false" enableDeleteByExample="false">
        </table>
    </context>
</generatorConfiguration>
黄舟

You need to create the folder in advance

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template