尝试通过在线方式安装,结果很坑爹,反正折腾半天,一直在下载中,始终不成功。最终放弃了,还是手动安装方便多了,不过相应的插件我找了半天,附件中有。同时links方式安装成功了。
安装成功:
根据上面向导创建配置文件generatorConfig.xml
<?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> <classPathEntry location="E:\workApp\Java\maven\repository\mysql\mysql-connector-java\5.1.25\mysql-connector-java-5.1.25.jar" /> <context id="context1"> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.0.200:3306/wd_test?useUnicode=true&characterEncoding=UTF-8" userId="root" password="qeemo1234" /> <javaModelGenerator targetPackage="com.techbirds.ms.model" targetProject="ms-dao/src/main/java" /> <sqlMapGenerator targetPackage="com.techbirds.ms.dao" targetProject="ms-dao/src/main/resources" /> <javaClientGenerator targetPackage="com.techbirds.ms.dao" targetProject="ms-dao/src/main/java" type="XMLMAPPER" /> <table schema="MS-USER" tableName="t_computer2" domainObjectName="Computer" enableInsert="true" enableSelectByPrimaryKey="true" enableUpdateByPrimaryKey="true" enableDeleteByPrimaryKey="true" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false"> </table> </context> </generatorConfiguration>
classPathEntry location:驱动地址,放入数据库对应的jdbc驱动jar路径(绝对路径)
jdbcConnection driverClass:驱动类(如oracle.jdbc.driver.OracleDriver),connectionURL:jdbc链接串(如jdbc:oracle:thin:@192.168.1.188:1521:xxx"), userId:数据用户名,password:数据库密码
javaModelGenerator targetPackage:生成的pojo放入的包, targetProject:生成的pojo放入的项目(对应工作空间的项目)
sqlMapGenerator targetPackage=生成的sql对应的包 targetProject:生成的sql接口对应的项目
javaClientGenerator targetPackage:生成的dao接口对应的包 targetProject:生成的dao接口对应的项目 type:映射文件类型,一般为XMLMAPPER
table:tableName:需要生成的表名,domainObjectName:生成的pojo名,为空则对应数据库表名
右键配置文件运行: