mybatis-generator-core-1.3.2-javadoc.jar
mybatis-generator-core-1.3.2-sources.jar
mybatis-generator-core-1.3.2.jar
mysql-connector-java-5.0.8-bin.jar
xml version="1.0"encoding="UTF-8"?>
DOCTYPE generatorConfiguration
PUBLIC"-//mybatis.org//DTD MyBatis GeneratorConfiguration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="testTables"targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressAllComments"value="true" />
commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEncoding=utf-8"
userId="root"
password="666666">
jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals"value="false" />
javaTypeResolver>
<javaModelGenerator targetPackage="com.mybatis.user.model"
targetProject=".\src">
<property name="enableSubPackages"value="false" />
<property name="trimStrings"value="true" />
javaModelGenerator>
<sqlMapGenerator targetPackage="com.mybatis.user.mapper"
targetProject=".\src">
<property name="enableSubPackages"value="false" />
sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.mybatis.user.mapper"
targetProject=".\src">
<property name="enableSubPackages"value="false" />
javaClientGenerator>
<table tableName="cy_user">table>
context>
generatorConfiguration>
public static void main(String[] args) throwsInvalidConfigurationException {
List
boolean overwrite = true;
//指定逆向工程配置文件
File configFile = new File("generatorConfig.xml");
ConfigurationParsercp = new ConfigurationParser(warnings);
try {
Configurationconfig = cp.parseConfiguration(configFile);
DefaultShellCallbackcallback = newDefaultShellCallback(overwrite);
MyBatisGeneratormyBatisGenerator = newMyBatisGenerator(config,
callback, warnings);
myBatisGenerator.generate(null);
} catch (IOException |XMLParserException e) {
// TODOAuto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODOAuto-generated catch block
e.printStackTrace();
} catch(InterruptedException e) {
// TODOAuto-generated catch block
e.printStackTrace();
}
}