Running MyBatis Generator

MyBatis Generator (MBG) can be run in the following ways:

Each method is described in detail on the linked pages.

Note: there is also an Eclipse plugin for MBG that adds extra function - namely good integration into Eclipse, an Eclipse enabled Ant task, and support for automatic merging of Java files. See the MyBatis web site page for information on installing the Eclipse plugin.

Important: When running outside of an IDE environment like Eclipse, MBG interprets the targetProject and targetPackage attributes in all XML configurations as follows:

  • targetProject is assumed to be an existing directory structure. MBG will fail if this directory structure does not exist. There is one exception to this rule - when MBG is running through the Maven plugin. See the Maven plugin page for information about how targetProject is interpreted in Maven.
  • targetPackage will be translated to a suitable subdirectory structure of the targetProject directory structure. MBG will create these subdirectories if necessary.