org.mybatis.generator.core_1.3.4.201608190045.jar
org.mybatis.generator.internal.DefaultCommentGenerator
http://download.csdn.net/download/paincupid/9904469
<generatorConfiguration >
<classPathEntry location="D:\ProgramData\jar_repo\mysql-jar\mysql-connector-java-5.1.30.jar" />
<context id="context1" targetRuntime="MyBatis3">
<property name="javaFileEncoding" value="UTF-8"/>
<property name="javaFormatter" value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>
<property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/>
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<plugin type="org.mybatis.generator.plugins.ToStringPlugin" />
<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
<plugin type="org.mybatis.generator.plugins.MySQLPaginationPlugin2">plugin>
<commentGenerator>
<property name="suppressAllComments" value="false"/>
commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/lee" userId="lee" password="eee" />
<javaModelGenerator targetPackage="arthur.dy.lee.model" targetProject="src/main/java" />
<sqlMapGenerator targetPackage="mapping" targetProject="src/main/resources" />
<javaClientGenerator targetPackage="arthur.dy.lee.dao" targetProject="src/main/java" type="XMLMAPPER" />
<table schema="" tableName="finance" domainObjectName="Finance">
table>
context>
generatorConfiguration>
package org.mybatis.generator.internal;
import static org.mybatis.generator.internal.util.StringUtility.isTrue;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import org.mybatis.generator.api.CommentGenerator;
import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.java.CompilationUnit;
import org.mybatis.generator.api.dom.java.Field;
import org.mybatis.generator.api.dom.java.InnerClass;
import org.mybatis.generator.api.dom.java.InnerEnum;
import org.mybatis.generator.api.dom.java.JavaElement;
import org.mybatis.generator.api.dom.java.Method;
import org.mybatis.generator.api.dom.java.Parameter;
import org.mybatis.generator.api.dom.java.TopLevelClass;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.config.MergeConstants;
import org.mybatis.generator.config.PropertyRegistry;
import org.mybatis.generator.internal.util.StringUtility;
/**
* The Class DefaultCommentGenerator.
*
*/
public class DefaultCommentGenerator implements CommentGenerator {
/** The properties. */
private Properties properties;
/** The suppress date. */
private boolean suppressDate;
/** The suppress all comments. */
private boolean suppressAllComments;
/** The addition of table remark's comments.
* If suppressAllComments is true, this option is ignored*/
private boolean addRemarkComments;
private SimpleDateFormat dateFormat;
/**
* Instantiates a new default comment generator.
*/
public DefaultCommentGenerator() {
super();
properties = new Properties();
suppressDate = false;
suppressAllComments = false;
addRemarkComments = false;
dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addJavaFileComment(org.mybatis.generator.api.dom.java.CompilationUnit)
*/
public void addJavaFileComment(CompilationUnit compilationUnit) {
// add no file level comments by default
}
/**
* Adds a suitable comment to warn users that the element was generated, and when it was generated.
*
* @param xmlElement
* the xml element
*/
public void addComment(XmlElement xmlElement) {
if (suppressAllComments) {
return;
}
xmlElement.addElement(new TextElement("")); //$NON-NLS-1$
/* StringBuilder sb = new StringBuilder();
sb.append(" WARNING - ");
sb.append(MergeConstants.NEW_ELEMENT_TAG);
xmlElement.addElement(new TextElement(sb.toString()));
xmlElement
.addElement(new TextElement(
" 1This element is automatically generated by MyBatis Generator, do not modify."));
String s = getDateString();
if (s != null) {
sb.setLength(0);
sb.append(" This element was generated on "); //$NON-NLS-1$
sb.append(s);
sb.append('.');
xmlElement.addElement(new TextElement(sb.toString()));
}*/
//xmlElement.addElement(new TextElement("-->")); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addRootComment(org.mybatis.generator.api.dom.xml.XmlElement)
*/
public void addRootComment(XmlElement rootElement) {
// add no document level comments by default
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addConfigurationProperties(java.util.Properties)
*/
public void addConfigurationProperties(Properties properties) {
this.properties.putAll(properties);
suppressDate = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE));
suppressAllComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS));
addRemarkComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_ADD_REMARK_COMMENTS));
String dateFormatString = properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_DATE_FORMAT);
if (StringUtility.stringHasValue(dateFormatString)) {
//dateFormat = new SimpleDateFormat(dateFormatString);
dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
}
}
/**
* This method adds the custom javadoc tag for. You may do nothing if you do not wish to include the Javadoc tag -
* however, if you do not include the Javadoc tag then the Java merge capability of the eclipse plugin will break.
*
* @param javaElement
* the java element
* @param markAsDoNotDelete
* the mark as do not delete
*/
protected void addJavadocTag(JavaElement javaElement,
boolean markAsDoNotDelete) {
javaElement.addJavaDocLine(" *"); //$NON-NLS-1$
StringBuilder sb = new StringBuilder();
sb.append(" * "); //$NON-NLS-1$
//sb.append(MergeConstants.NEW_ELEMENT_TAG);
if (markAsDoNotDelete) {
sb.append(" do_not_delete_during_merge"); //$NON-NLS-1$
}
String s = getDateString();
if (s != null) {
sb.append(' ');
sb.append(s);
}
javaElement.addJavaDocLine(sb.toString());
}
/**
* This method returns a formated date string to include in the Javadoc tag
* and XML comments. You may return null if you do not want the date in
* these documentation elements.
*
* @return a string representing the current timestamp, or null
*/
protected String getDateString() {
if (suppressDate) {
return null;
} else if (dateFormat != null) {
return dateFormat.format(new Date());
} else {
return new Date().toString();
}
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addClassComment(org.mybatis.generator.api.dom.java.InnerClass, org.mybatis.generator.api.IntrospectedTable)
*/
public void addClassComment(InnerClass innerClass,
IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
// StringBuilder sb = new StringBuilder();
//
innerClass.addJavaDocLine("/** " +introspectedTable.getFullyQualifiedTable()+" **/"); //$NON-NLS-1$
// /*innerClass
// .addJavaDocLine(" * 2This class was generated by MyBatis Generator.");
//
// sb.append(" * This class corresponds to the database table "); */
// sb.append(introspectedTable.getFullyQualifiedTable());
// innerClass.addJavaDocLine(sb.toString());
//
// addJavadocTag(innerClass, false);
//
// innerClass.addJavaDocLine(" **/"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addTopLevelClassComment(org.mybatis.generator.api.dom.java.TopLevelClass, org.mybatis.generator.api.IntrospectedTable)
*/
@Override
public void addModelClassComment(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
if (suppressAllComments || !addRemarkComments) {
return;
}
//StringBuilder sb = new StringBuilder();
topLevelClass.addJavaDocLine("/**lee20160923a "+ introspectedTable.getFullyQualifiedTable()); //$NON-NLS-1$
String remarks = introspectedTable.getRemarks();
if (addRemarkComments && StringUtility.stringHasValue(remarks)) {
//topLevelClass.addJavaDocLine(" * 3Database Table Remarks:");
String[] remarkLines = remarks.split(System.getProperty("line.separator")); //$NON-NLS-1$
for (String remarkLine : remarkLines) {
topLevelClass.addJavaDocLine(" * lee20160923b" + remarkLine); //$NON-NLS-1$
}
}
/* topLevelClass.addJavaDocLine(" *"); //$NON-NLS-1$
topLevelClass.addJavaDocLine(" * "); //$NON-NLS-1$
sb.append(introspectedTable.getFullyQualifiedTable());
topLevelClass.addJavaDocLine(sb.toString());
addJavadocTag(topLevelClass, true);*/
topLevelClass.addJavaDocLine(" */"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addEnumComment(org.mybatis.generator.api.dom.java.InnerEnum, org.mybatis.generator.api.IntrospectedTable)
*/
public void addEnumComment(InnerEnum innerEnum,
IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
// StringBuilder sb = new StringBuilder();
//
// innerEnum.addJavaDocLine("/**"); //$NON-NLS-1$
// innerEnum
// .addJavaDocLine(" * 51This enum was generated by MyBatis Generator."); //$NON-NLS-1$
//
// sb.append(" * 52This enum corresponds to the database table "); //$NON-NLS-1$
// sb.append(introspectedTable.getFullyQualifiedTable());
// innerEnum.addJavaDocLine(sb.toString());
//
// addJavadocTag(innerEnum, false);
//
// innerEnum.addJavaDocLine(" */"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addFieldComment(org.mybatis.generator.api.dom.java.Field, org.mybatis.generator.api.IntrospectedTable, org.mybatis.generator.api.IntrospectedColumn)
*/
public void addFieldComment(Field field,
IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
if (suppressAllComments) {
return;
}
String remarks = introspectedColumn.getRemarks()+" "+ introspectedColumn.getActualColumnName();
field.addJavaDocLine("/** "+remarks+ " **/");
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addFieldComment(org.mybatis.generator.api.dom.java.Field, org.mybatis.generator.api.IntrospectedTable)
*/
public void addFieldComment(Field field, IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
// StringBuilder sb = new StringBuilder();
//
field.addJavaDocLine("/** tableName: "+introspectedTable.getFullyQualifiedTable()+" **/");
// field.addJavaDocLine(introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime()); //$NON-NLS-1$
//
// sb.append(introspectedTable.getFullyQualifiedTable());
// field.addJavaDocLine(sb.toString());
//
// addJavadocTag(field, false);
//
// field.addJavaDocLine(" */"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addGeneralMethodComment(org.mybatis.generator.api.dom.java.Method, org.mybatis.generator.api.IntrospectedTable)
*/
public void addGeneralMethodComment(Method method,
IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
// StringBuilder sb = new StringBuilder();
//
// method.addJavaDocLine("/**"); //$NON-NLS-1$
// method
// .addJavaDocLine(" * 7This method was generated by MyBatis Generator."); //$NON-NLS-1$
//
// sb.append(" * 72This method corresponds to the database table "); //$NON-NLS-1$
// sb.append(introspectedTable.getFullyQualifiedTable());
// method.addJavaDocLine(sb.toString());
//
// addJavadocTag(method, false);
//
// method.addJavaDocLine(" */"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addGetterComment(org.mybatis.generator.api.dom.java.Method, org.mybatis.generator.api.IntrospectedTable, org.mybatis.generator.api.IntrospectedColumn)
*/
public void addGetterComment(Method method,
IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
if (suppressAllComments) {
return;
}
method.addJavaDocLine("/** "+introspectedColumn.getRemarks()+" "+ introspectedColumn.getActualColumnName() +" **/");
}
public void addSetterComment(Method method,
IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
if (suppressAllComments) {
return;
}
method.addJavaDocLine("/** "+introspectedColumn.getRemarks()+" "+ introspectedColumn.getActualColumnName() +" **/");
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.CommentGenerator#addClassComment(org.mybatis.generator.api.dom.java.InnerClass, org.mybatis.generator.api.IntrospectedTable, boolean)
*/
public void addClassComment(InnerClass innerClass,
IntrospectedTable introspectedTable, boolean markAsDoNotDelete) {
if (suppressAllComments) {
return;
}
// StringBuilder sb = new StringBuilder();
//
innerClass.addJavaDocLine("/** tableName: "+introspectedTable.getFullyQualifiedTable()+" **/"); //$NON-NLS-1$
// innerClass
// .addJavaDocLine(" * 8This class was generated by MyBatis Generator."); //$NON-NLS-1$
//
// sb.append(" * 82This class corresponds to the database table "); //$NON-NLS-1$
// sb.append(introspectedTable.getFullyQualifiedTable());
// innerClass.addJavaDocLine(sb.toString());
//
// addJavadocTag(innerClass, markAsDoNotDelete);
//
// innerClass.addJavaDocLine(" */"); //$NON-NLS-1$
}
}
<plugin type="org.mybatis.generator.plugins.MySQLPaginationPlugin">plugin>
下载mybaits-generator源下载,然后在org.mybatis.generator.plugins路径下新建一下类:MySQLPaginationPlugin
然后编辑后放到eclipse->plugin下的 org.mybatis.generator.core_1.3.4.201608190045.jar包里即可。
这样做的好处是,如果你自己写的话,你需要打成jar包,然后再在本地仓库引用,比较麻烦,否则你会抛无法实例化对象的错误。错误如下所示:
D:\Workspaces_All\2016.08.13-neon-springmvc\.metadata\.plugins\org.mybatis.generator.eclipse.ui\.generatedAntScripts\springmvc-generatorConfig.xml.xml:4: java.lang.RuntimeException: Cannot instantiate object of type org.mybatis.generator.plugins.MySQLPaginationPlugin
java.lang.RuntimeException: Cannot instantiate object of type org.mybatis.generator.plugins.MySQLPaginationPlugin
package org.mybatis.generator.plugins;
import java.util.List;
import org.mybatis.generator.api.CommentGenerator;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.Field;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
import org.mybatis.generator.api.dom.java.JavaVisibility;
import org.mybatis.generator.api.dom.java.Method;
import org.mybatis.generator.api.dom.java.Parameter;
import org.mybatis.generator.api.dom.java.TopLevelClass;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
public class MySQLPaginationPlugin extends PluginAdapter {
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
// add field, getter, setter for limit clause
addLimit(topLevelClass, introspectedTable, "offset");
addLimit(topLevelClass, introspectedTable, "limit");
return super.modelExampleClassGenerated(topLevelClass, introspectedTable);
}
@Override
public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(XmlElement element,
IntrospectedTable introspectedTable) {
XmlElement isNotNullElement = new XmlElement("if"); //$NON-NLS-1$
isNotNullElement.addAttribute(new Attribute("test", "offset != null and offset >= 0 and limit != null and limit>=0")); //$NON-NLS-1$ //$NON-NLS-2$
isNotNullElement.addElement(new TextElement("limit ${offset} , ${limit}"));
element.addElement(isNotNullElement);
return super.sqlMapUpdateByExampleWithoutBLOBsElementGenerated(element, introspectedTable);
}
private void addLimit(TopLevelClass topLevelClass, IntrospectedTable introspectedTable, String name) {
CommentGenerator commentGenerator = context.getCommentGenerator();
Field field = new Field();
field.setVisibility(JavaVisibility.PROTECTED);
//field.setType(FullyQualifiedJavaType.getIntInstance());
field.setType(new FullyQualifiedJavaType("Integer"));
field.setName(name);
field.setInitializationString("-1");
commentGenerator.addFieldComment(field, introspectedTable);
topLevelClass.addField(field);
char c = name.charAt(0);
String camel = Character.toUpperCase(c) + name.substring(1);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setName("set" + camel);
//method.addParameter(new Parameter(FullyQualifiedJavaType.getIntInstance(), name));
method.addParameter(new Parameter(new FullyQualifiedJavaType("Integer"), name));
method.addBodyLine("this." + name + "=" + name + ";");
commentGenerator.addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
//method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setReturnType(new FullyQualifiedJavaType("Integer"));
method.setName("get" + camel);
method.addBodyLine("return " + name + ";");
commentGenerator.addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
}
@Override
public boolean validate(List arg0) {
return true;
}
}
package org.mybatis.generator.plugins;
import org.mybatis.generator.api.CommentGenerator;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.*;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
import java.util.List;
public class MySQLPagerPlugin extends PluginAdapter {
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
addPage(topLevelClass, introspectedTable, "page");
return super.modelExampleClassGenerated(topLevelClass, introspectedTable);
}
@Override
public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(XmlElement element,
IntrospectedTable introspectedTable) {
XmlElement page = new XmlElement("if");
page.addAttribute(new Attribute("test", "page != null"));
page.addElement(new TextElement("limit #{page.begin} , #{page.length}"));
element.addElement(page);
return super.sqlMapUpdateByExampleWithoutBLOBsElementGenerated(element, introspectedTable);
}
/**
* @param topLevelClass
* @param introspectedTable
* @param name
*/
private void addPage(TopLevelClass topLevelClass, IntrospectedTable introspectedTable,
String name) {
topLevelClass.addImportedType(new FullyQualifiedJavaType(
"com.aliyun.activity.dal.model.Page"));
CommentGenerator commentGenerator = context.getCommentGenerator();
Field field = new Field();
field.setVisibility(JavaVisibility.PROTECTED);
field.setType(new FullyQualifiedJavaType("com.aliyun.activity.dal.model.Page"));
field.setName(name);
commentGenerator.addFieldComment(field, introspectedTable);
topLevelClass.addField(field);
char c = name.charAt(0);
String camel = Character.toUpperCase(c) + name.substring(1);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setName("set" + camel);
method.addParameter(new Parameter(new FullyQualifiedJavaType(
"com.aliyun.activity.dal.model.Page"), name));
method.addBodyLine("this." + name + "=" + name + ";");
commentGenerator.addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(new FullyQualifiedJavaType("com.aliyun.babel.model.Page"));
method.setName("get" + camel);
method.addBodyLine("return " + name + ";");
commentGenerator.addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
}
/**
* This plugin is always valid - no properties are required
*/
public boolean validate(List warnings) {
return true;
}
}
如果使用page对象进行分页,需要加入page类
import java.io.Serializable;
public final class Page implements Serializable {
/**
* 默认的序列化版本 id.
*/
private static final long serialVersionUID = 1L;
/**
* 分页查询开始记录位置.
*/
private int begin;
/**
* 分页查看下结束位置.
*/
private int end;
/**
* 每页显示记录数.
*/
private int length = 20;
/**
* 查询结果总记录数.
*/
private int totalRecords;
/**
* 当前页码.
*/
private int pageNo;
/**
* 总共页数.
*/
private int pageCount;
public Page() {
}
/**
* 构造函数.
*
* @param begin
* @param length
*/
public Page(int begin, int length) {
this.begin = begin;
this.length = length;
this.end = this.begin + this.length;
this.pageNo = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
/**
* @param begin
* @param length
* @param count
*/
public Page(int begin, int length, int totalRecords) {
this(begin, length);
this.totalRecords = totalRecords;
}
/**
* 设置页数,自动计算数据范围.
*
*/
public Page(int pageNo) {
this.pageNo = pageNo;
pageNo = pageNo > 0 ? pageNo : 1;
this.begin = this.length * (pageNo - 1);
this.end = this.length * pageNo;
}
public int getBegin() {
return begin;
}
public int getEnd() {
return end;
}
public void setEnd(int end) {
this.end = end;
}
public void setBegin(int begin) {
this.begin = begin;
if (this.length != 0) {
this.pageNo = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
if (this.begin != 0) {
this.pageNo = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
}
public int getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
this.pageCount = (int) Math.floor((this.totalRecords * 1.0d) / this.length);
if (this.totalRecords % this.length != 0) {
this.pageCount++;
}
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
pageNo = pageNo > 0 ? pageNo : 1;
this.begin = this.length * (pageNo - 1);
this.end = this.length * pageNo;
}
public int getPageCount() {
if (pageCount == 0) {
return 1;
}
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder("begin=").append(begin).append(", end=")
.append(end).append(", length=").append(length).append(", totalRecords=").append(
totalRecords).append(", pageNo=").append(pageNo).append(", pageCount=")
.append(pageCount);
return builder.toString();
}
}
<build>
<plugins>
<plugin>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-maven-pluginartifactId>
plugin>
<plugin>
<groupId>org.mybatis.generatorgroupId>
<artifactId>mybatis-generator-maven-pluginartifactId>
<version>1.3.4version>
<dependencies>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<version>5.1.34version>
dependency>
dependencies>
<configuration>
<verbose>trueverbose>
<overwrite>trueoverwrite>
configuration>
plugin>
plugins>
build>
用上面csdn资源上下载的 mybatis-generator-core-1.3.4.jar
覆盖 C:\Users\Administrator.m2\repository\org\mybatis\generator\mybatis-generator-core\1.3.4\mybatis-generator-core-1.3.4.jar (如果是用的idea默认的maven的话)
http://blog.csdn.net/paincupid/article/details/52645610