Running MyBatis Generator
MyBatis Generator (MBG) can be run in the following ways:
- From the command prompt with an XML configuration
- As an Ant task with an XML configuration
- As a Maven Plugin
- From another Java program with an XML configuration
- From another Java program with a Java based configuration
- As an Eclipse Feature
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 howtargetProject
is interpreted in Maven.targetPackage
will be translated to a suitable subdirectory structure of thetargetProject
directory structure. MBG will create these subdirectories if necessary.