前言
在使用maven配置Mybatis generator插件时报以下错误,generator插件一直无法使用,查询资料说和eclipse版本有关系。
The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
无奈之下选择安装eclipse的插件。
安装步骤(基于MyEclipse2018)
- 点击help-->install from catalog...
- 在搜索框输入MyBatis Generator出现点击install-->Finish.如下图所示
- 安装完成后在项目中右击新建MyBatis Generator configuration file.如下图所示
- 点击next 选择文件生成的路径以及文件名,如下图所示
-
点击Finfish。具体配置可参考以下配置进行修改
<?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><context id="context1"> <!-- 数据库链接URL,用户名、密码 --> <jdbcConnection connectionURL="jdbc:mysql://localhost:3306/miaosha?characterEncoding=utf8" driverClass="com.mysql.jdbc.Driver" password="jma3" userId="root" /> <!-- 生成model模型,对应的包 --> <javaModelGenerator targetPackage="com.jian.miaosha.dataobject" targetProject="miaosha/src/main/java" /> <!-- 对应的xml mapper文件 --> <sqlMapGenerator targetPackage="mapping" targetProject="miaosha/src/main/resources" /> <!-- 对应的dao接口 --> <javaClientGenerator targetPackage="com.jian.miaosha.dao" targetProject="miaosha/src/main/java" type="XMLMAPPER" /> <!-- 要生成的表 --> <table schema="" tableName="customer_password"> </table> <table schema="" tableName="customer"> </table> </context></generatorConfiguration>
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。