Package org.mybatis.generator.maven
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 Summary
FieldsModifier and TypeFieldDescriptionprivate FileLocation of the configuration file.private StringComma delimited list of contexts to generate.private booleanIf true, then dependencies in all scopes will be added to the classpath of the generator.private booleanIf true, then dependencies in scope compile, provided, and system scopes will be added to the classpath of the generator.private StringJDBC Driver to use if a sql.script.file is specified.private StringJDBC password to use if a sql.script.file is specified.private StringJDBC URL to use if a sql.script.file is specified.private StringJDBC user ID to use if a sql.script.file is specified.private FileOutput Directory.private booleanSpecifies whether the mojo overwrites existing Java files.private org.apache.maven.project.MavenProjectMaven Project.private ThreadLocal<ClassLoader> private booleanSkip generator.private StringLocation of a SQL script file to run before generating code.private StringComma delimited list of table names to generate.private booleanSpecifies whether the mojo writes progress messages to the log.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidexecute()private voidprivate voidprivate voidMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
savedClassloader
-
project
@Parameter(property="project", required=true, readonly=true) private org.apache.maven.project.MavenProject projectMaven Project. -
outputDirectory
@Parameter(property="mybatis.generator.outputDirectory", defaultValue="${project.build.directory}/generated-sources/mybatis-generator", required=true) private File outputDirectoryOutput Directory. -
configurationFile
@Parameter(property="mybatis.generator.configurationFile", defaultValue="${project.basedir}/src/main/resources/generatorConfig.xml", required=true) private File configurationFileLocation of the configuration file. -
verbose
@Parameter(property="mybatis.generator.verbose", defaultValue="false") private boolean verboseSpecifies whether the mojo writes progress messages to the log. -
overwrite
@Parameter(property="mybatis.generator.overwrite", defaultValue="false") private boolean overwriteSpecifies whether the mojo overwrites existing Java files. Default is false.
Note that XML files are always merged. -
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
JDBC Driver to use if a sql.script.file is specified. -
jdbcURL
JDBC URL to use if a sql.script.file is specified. -
jdbcUserId
JDBC user ID to use if a sql.script.file is specified. -
jdbcPassword
JDBC password to use if a sql.script.file is specified. -
tableNames
Comma delimited list of table names to generate. -
contexts
Comma delimited list of contexts to generate. -
skip
@Parameter(property="mybatis.generator.skip", defaultValue="false") private boolean skipSkip generator. -
includeCompileDependencies
@Parameter(property="mybatis.generator.includeCompileDependencies", defaultValue="false") private boolean includeCompileDependenciesIf 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 includeAllDependenciesIf 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
-
saveClassLoader
private void saveClassLoader() -
restoreClassLoader
private void restoreClassLoader()
-