1. Download the package addresshttp://download.csdn.net/detail/u012909091/72060912. Download and unzip the file to any directory3. Delete all files under mybatis-generator-core-1.3.2\mybatis-generator-core-1.3.2\lib\src
4. Modify the configuration file Mybatis-generator-core-1.3.2\mybatis-generator-core-1.3.2\lib\generatorconfig.xml file<?xml version= "1.0" encoding= "UTF-8"? ><! DOCTYPE generatorconfigurationpublic "-//mybatis.org//dtd mybatis Generator Configuration 1.0//en" "/HTTP/ MYBATIS.ORG/DTD/MYBATIS-GENERATOR-CONFIG_1_0.DTD "><generatorConfiguration><!--database driver-->< Classpathentry location= "Mysql-connector-java-5.1.25-bin.jar"/><context id= "DB2Tables" TargetRuntime= " MyBatis3 "><commentgenerator><property name=" Suppressdate "value=" true "/><!--whether to remove auto-generated comments true: Yes: False: No--><property name= "suppressallcomments" value= "true"/></commentgenerator><!--database link URL, User name, password--><jdbcconnection driverclass= "Com.mysql.jdbc.Driver" connectionurl="Jdbc:mysql://localhost:3306/generator" userid= "root" password= "249832" ></jdbcconnection><javatyperesolver><property name= "Forcebigdecimals" value= "false"/></ javatyperesolver><!--generate the package name and location of the model--><javamodelgenerator targetpackage= "test.domain" targetProject= "src "><property name=" Enablesubpackages "value=" true "/><property name=" Trimstrings "value=" true "/></ javamodelgenerator><!--generate the package name and location of the mapping file--><sqlmapgenerator targetpackage= "test.mapping" targetProject= " SRC "><property name=" Enablesubpackages "value=" true "/></sqlmapgenerator><!--generate DAO's package name and location-- <javaclientgenerator type= "Xmlmapper" targetpackage= "test. Idao "targetproject=" src "><property name=" Enablesubpackages "value=" true "/></javaclientgenerator> <!--the table TableName to be generated is the name of the table or view in the database Domainobjectname is the entity class name--><tabletablename= "test" domainobjectname= "test" enablecountbyexample= "false" enableupdatebyexample= "false" Enabledeletebyexample= "false" enableselectbyexample= "false" Selectbyexamplequeryid= "false" ></table> </context></generatorConfiguration>
5. Use CMD to enter your directory CD C:\USERS\FXL\DESKTOP\MYBATIS-GENERATOR-CORE-1.3.2\MYBATIS-GENERATOR-CORE-1.3.2\LIB\SRC
Input command Java-jar mybatis-generator-core-1.3.2.jar-configfile generatorconfig.xml-overwrite
6. Build completed to the Lib directory to find the specified file can be
Automatically generate model mapper mapping files using generator