Class MyBatisGeneratorMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.mybatis.generator.maven.MyBatisGeneratorMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="generate", defaultPhase=GENERATE_SOURCES, requiresDependencyResolution=TEST) public class MyBatisGeneratorMojo extends org.apache.maven.plugin.AbstractMojo
Goal which generates MyBatis artifacts.
  • Field Details

    • savedClassloader

      private ThreadLocal<ClassLoader> savedClassloader
    • project

      @Parameter(property="project", required=true, readonly=true) private org.apache.maven.project.MavenProject project
      Maven Project.
    • outputDirectory

      @Parameter(property="mybatis.generator.outputDirectory", defaultValue="${project.build.directory}/generated-sources/mybatis-generator", required=true) private File outputDirectory
      Output Directory.
    • configurationFile

      @Parameter(property="mybatis.generator.configurationFile", defaultValue="${project.basedir}/src/main/resources/generatorConfig.xml", required=true) private File configurationFile
      Location of the configuration file.
    • verbose

      @Parameter(property="mybatis.generator.verbose", defaultValue="false") private boolean verbose
      Specifies whether the mojo writes progress messages to the log.
    • overwrite

      @Parameter(property="mybatis.generator.overwrite", defaultValue="false") private boolean overwrite
      Specifies whether the mojo overwrites existing Java files. Default is false.
      Note that XML files are always merged.
    • sqlScript

      @Parameter(property="mybatis.generator.sqlScript") private String sqlScript
      Location of a SQL script file to run before generating code. If null, then no script will be run. If not null, then jdbcDriver, jdbcURL must be supplied also, and jdbcUserId and jdbcPassword may be supplied.
    • jdbcDriver

      @Parameter(property="mybatis.generator.jdbcDriver") private String jdbcDriver
      JDBC Driver to use if a sql.script.file is specified.
    • jdbcURL

      @Parameter(property="mybatis.generator.jdbcURL") private String jdbcURL
      JDBC URL to use if a sql.script.file is specified.
    • jdbcUserId

      @Parameter(property="mybatis.generator.jdbcUserId") private String jdbcUserId
      JDBC user ID to use if a sql.script.file is specified.
    • jdbcPassword

      @Parameter(property="mybatis.generator.jdbcPassword") private String jdbcPassword
      JDBC password to use if a sql.script.file is specified.
    • tableNames

      @Parameter(property="mybatis.generator.tableNames") private String tableNames
      Comma delimited list of table names to generate.
    • contexts

      @Parameter(property="mybatis.generator.contexts") private String contexts
      Comma delimited list of contexts to generate.
    • skip

      @Parameter(property="mybatis.generator.skip", defaultValue="false") private boolean skip
      Skip generator.
    • includeCompileDependencies

      @Parameter(property="mybatis.generator.includeCompileDependencies", defaultValue="false") private boolean includeCompileDependencies
      If true, then dependencies in scope compile, provided, and system scopes will be added to the classpath of the generator. These dependencies will be searched for JDBC drivers, root classes, root interfaces, generator plugins, etc.
    • includeAllDependencies

      @Parameter(property="mybatis.generator.includeAllDependencies", defaultValue="false") private boolean includeAllDependencies
      If true, then dependencies in all scopes will be added to the classpath of the generator. These dependencies will be searched for JDBC drivers, root classes, root interfaces, generator plugins, etc.
  • Constructor Details

    • MyBatisGeneratorMojo

      public MyBatisGeneratorMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • calculateClassPath

      private void calculateClassPath() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • runScriptIfNecessary

      private void runScriptIfNecessary() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getOutputDirectory

      public File getOutputDirectory()
    • saveClassLoader

      private void saveClassLoader()
    • restoreClassLoader

      private void restoreClassLoader()