MyBatisGenerator的自动生成代码之Eclipse

下载地址:

https://github.com/mybatis/generator/releases



MyBatisGenerator的自动生成代码之Eclipse_第1张图片


然后在Eclipse中安装

MyBatisGenerator的自动生成代码之Eclipse_第2张图片



选择刚刚下载的压缩包,再随便起一个name

MyBatisGenerator的自动生成代码之Eclipse_第3张图片



Contact allu update...   取消自动更新

再勾选MyBaties Generator 那二项

MyBatisGenerator的自动生成代码之Eclipse_第4张图片



创建一个简单的项目

MyBatisGenerator的自动生成代码之Eclipse_第5张图片



配置maven

MyBatisGenerator的自动生成代码之Eclipse_第6张图片



设置user settings

MyBatisGenerator的自动生成代码之Eclipse_第7张图片



加载架包Mybatis

pom.xml

[html]  view plain  copy
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
  2.   <modelVersion>4.0.0modelVersion>  
  3.   <groupId>cn.etgroupId>  
  4.   <artifactId>MybatisartifactId>  
  5.   <version>0.0.1-SNAPSHOTversion>  
  6.     
  7.   <dependencies>  
  8.       
  9.     <dependency>  
  10.       <groupId>org.mybatisgroupId>  
  11.       <artifactId>mybatisartifactId>  
  12.       <version>3.2.8version>  
  13.     dependency>  
  14.       
  15.   dependencies>  
  16. project>  


加载架包ojdbc

直接build path吧

MyBatisGenerator的自动生成代码之Eclipse_第8张图片



生成MyBatiesGenerator配置文件

new一个

MyBatisGenerator的自动生成代码之Eclipse_第9张图片



generatorConfig.xml

[html]  view plain  copy
  1. xml version="1.0" encoding="UTF-8"?>  
  2. >  
  3. <generatorConfiguration>  
  4.   
  5.   
  6.   
  7.   <context id="context1">  
  8.       
  9.       
  10.     <jdbcConnection connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" driverClass="oracle.jdbc.OracleDriver" password="tiger" userId="scott" />  
  11.       
  12.       
  13.     <sqlMapGenerator targetPackage="cn.et.mabatis.dao" targetProject="Mybatis/src/main/java" />  
  14.       
  15.     

你可能感兴趣的:(mybatis)