Package org.liquibase.maven.plugins
Class AbstractLiquibaseMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.liquibase.maven.plugins.AbstractLiquibaseMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractLiquibaseChangeLogMojo,LiquibaseClearChecksumsMojo,LiquibaseDropAll,LiquibaseGenerateChangeLogMojo,LiquibaseHistoryMojo,LiquibaseListLocksMojo,LiquibaseReleaseLocksMojo,LiquibaseTag,LiquibaseTagExistsMojo
public abstract class AbstractLiquibaseMojo
extends org.apache.maven.plugin.AbstractMojo
A base class for providing Liquibase
Liquibase functionality.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BooleanEnable or disable sending product usage data and analytics to Liquibase.protected StringSpecifies the fully qualified class name of the custom ChangeExecListenerprotected StringSpecifies the property file for controlling the custom ChangeExecListenerprotected StringSpecifies the schema Liquibase will use to create your changelog tables.protected StringSpecifies the schema Liquibase will use to create your changelog table.protected booleanA flag that forces checksums to be cleared from the DATABASECHANGELOG table.protected Stringprotected StringSpecifies the table name to use for the DATABASECHANGELOGLOCK table.protected StringSpecifies the table name to use for the DATABASECHANGELOG table.protected StringSpecifies the database object class.protected StringSpecifies the default catalog name to use for the database connection.protected DefaultChangeExecListenerprotected StringSpecifies the default schema name to use for the database connection.protected StringSpecifies the driver class name to use for the database connection.protected booleanDeprecated.Use an empty or null value for the password instead.protected booleanIncludes a Maven project artifact in the class loader which obtains the liquibase.properties and changelog files.protected booleanIncludes the Maven test output directory in the class loader which obtains the liquibase.properties and changelog files.protected StringDeprecated.Logging managed by mavenprotected StringDetermines the minimum log level liquibase uses when logging.protected org.apache.maven.plugin.MojoExecutionprotected booleanSpecifies whether to ignore the catalog/database name.protected booleanSpecifies whether to ignore the schema name.protected StringA flag which indicates you want to set the character encoding of the output file during the updateSQL phase.protected StringSpecifies the database password for database connection.protected BooleanSpecifies whether to preserve the case of schemas and catalogsprotected org.apache.maven.project.MavenProjectThe Maven project that plugin is running under.protected booleanDeprecated.No longer promptsprotected StringSpecifies the liquibase.properties you want to use to configure Liquibase.protected booleanA flag which indicates you want the liquibase.properties file to override any settings provided in the Maven plugin configuration.protected StringSpecifies the property provider which must be a java.util.Properties implementation.protected StringSpecifies the locations where Liquibase can find your changelog files.protected org.apache.maven.execution.MavenSessionprotected booleanShow the liquibase banner in output.protected booleanSpecifies whether to skip running Liquibase.protected StringSkip plugin execution if the specified file exists.protected BooleanWhen set to true, this global property prevents DBCL sql from being present in console and logs during *-sql commands, such as update-sql, rollback-sql, etc.protected PropertiesSpecifies a list of system properties you want to pass to the database.protected StringSpecifies the database URL you want to use to execute Liquibase.protected StringSpecifies the database username for database connection.protected booleanControls the amount of output detail when you call the plugin.protected org.apache.maven.artifact.manager.WagonManagerThe Maven Wagon manager to use when obtaining server authentication details.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms some validation after the properties file has been loaded checking that all properties required have been specified.protected voidprotected voidvoidprotected LiquibasebooleanOptionally, an implementation of this mojo can override this to indicate that a connection to the database is not required.voidexecute()protected ClassLoaderReturns an isolated classloader.protected Fieldprotected Liquibaseorg.apache.maven.plugin.logging.LoggetLog()protected ClassLoaderprotected OutputStreamgetOutputStream(String outputFile) Returns the OutputStream based on whether there is an outputFile provided.protected WritergetOutputWriter(File outputFile) protected ResourceAccessorprotected booleanDeprecated.no longer promptsprotected voidparsePropertiesFile(InputStream propertiesInputStream) Parses a properties file and sets the associated fields in the plugin.protected abstract voidperformLiquibaseTask(Liquibase liquibase) protected voidprintSettings(String indent) Prints the settings that have been set of defaulted for the plugin.protected voidMethods inherited from class org.apache.maven.plugin.AbstractMojo
getPluginContext, setLog, setPluginContext
-
Field Details
-
preserveSchemaCase
Specifies whether to preserve the case of schemas and catalogs -
driver
Specifies the driver class name to use for the database connection. -
url
Specifies the database URL you want to use to execute Liquibase. -
wagonManager
protected org.apache.maven.artifact.manager.WagonManager wagonManagerThe Maven Wagon manager to use when obtaining server authentication details. -
username
Specifies the database username for database connection. -
password
Specifies the database password for database connection. -
emptyPassword
Deprecated.Use an empty or null value for the password instead.Use an empty string as the password for the database connection. This should not be used along side thepasswordsetting. -
outputDefaultSchema
Specifies whether to ignore the schema name. -
outputDefaultCatalog
Specifies whether to ignore the catalog/database name. -
defaultCatalogName
Specifies the default catalog name to use for the database connection. -
defaultSchemaName
Specifies the default schema name to use for the database connection. -
databaseClass
Specifies the database object class. -
propertyProviderClass
Specifies the property provider which must be a java.util.Properties implementation. -
promptOnNonLocalDatabase
Deprecated.No longer prompts(DEPRECATED) Controls whether users are prompted before executing changeSet to a non-local database. -
includeArtifact
Includes a Maven project artifact in the class loader which obtains the liquibase.properties and changelog files. -
includeTestOutputDirectory
Includes the Maven test output directory in the class loader which obtains the liquibase.properties and changelog files. -
verbose
Controls the amount of output detail when you call the plugin. -
logging
Deprecated.Logging managed by mavenDeprecated and ignored configuration property. Logging is managed via the standard maven logging system either using the -e, -X or -q flags or the ${maven.home}/conf/logging/simplelogger.properties file.- See Also:
-
logLevel
Determines the minimum log level liquibase uses when logging.Supported values are:
- DEBUG
- INFO
- WARNING
- ERROR
NOTE: The final log level is the maximum of this value and the maven log level. Thus, it is not possible to decrease the effective log level with this option.
-
propertyFile
Specifies the liquibase.properties you want to use to configure Liquibase. -
propertyFileWillOverride
A flag which indicates you want the liquibase.properties file to override any settings provided in the Maven plugin configuration. By default, if a property is explicitly specified it is not overridden if it also appears in the properties file. -
clearCheckSums
A flag that forces checksums to be cleared from the DATABASECHANGELOG table. -
systemProperties
Specifies a list of system properties you want to pass to the database. -
project
protected org.apache.maven.project.MavenProject projectThe Maven project that plugin is running under. -
session
protected org.apache.maven.execution.MavenSession session -
mojoExecution
protected org.apache.maven.plugin.MojoExecution mojoExecution -
skip
Specifies whether to skip running Liquibase. The use of this parameter is NOT RECOMMENDED but can be used when needed. -
skipOnFileExists
Skip plugin execution if the specified file exists. The use of this parameter is NOT RECOMMENDED but can be used when needed. -
outputFileEncoding
A flag which indicates you want to set the character encoding of the output file during the updateSQL phase. -
changelogCatalogName
Specifies the schema Liquibase will use to create your changelog tables. -
changelogSchemaName
Specifies the schema Liquibase will use to create your changelog table. -
databaseChangeLogTableName
Specifies the table name to use for the DATABASECHANGELOG table. -
databaseChangeLogLockTableName
Specifies the table name to use for the DATABASECHANGELOGLOCK table. -
showBanner
Show the liquibase banner in output. -
searchPath
Specifies the locations where Liquibase can find your changelog files. -
changeExecListenerClass
Specifies the fully qualified class name of the custom ChangeExecListener -
changeExecListenerPropertiesFile
Specifies the property file for controlling the custom ChangeExecListener -
analyticsEnabled
Enable or disable sending product usage data and analytics to Liquibase. -
suppressLiquibaseSql
When set to true, this global property prevents DBCL sql from being present in console and logs during *-sql commands, such as update-sql, rollback-sql, etc. -
commandName
-
defaultChangeExecListener
-
-
Constructor Details
-
AbstractLiquibaseMojo
public AbstractLiquibaseMojo()
-
-
Method Details
-
getOutputWriter
- Throws:
IOException
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getField
- Throws:
NoSuchFieldException
-
getLiquibase
-
setupBindInfoPackage
protected void setupBindInfoPackage() -
performLiquibaseTask
- Throws:
LiquibaseException
-
isPromptOnNonLocalDatabase
protected boolean isPromptOnNonLocalDatabase()Deprecated.no longer prompts -
createLiquibase
protected Liquibase createLiquibase(Database db) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
configureFieldsAndValues
public void configureFieldsAndValues() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
configureChangeLogProperties
protected void configureChangeLogProperties() throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionException
-
getMavenArtifactClassLoader
protected ClassLoader getMavenArtifactClassLoader() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getClassLoaderIncludingProjectClasspath
protected ClassLoader getClassLoaderIncludingProjectClasspath() throws org.apache.maven.plugin.MojoExecutionExceptionReturns an isolated classloader.- Returns:
- ClassLoader
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getResourceAccessor
protected ResourceAccessor getResourceAccessor(ClassLoader cl) throws IOException, org.apache.maven.plugin.MojoFailureException - Throws:
IOExceptionorg.apache.maven.plugin.MojoFailureException
-
checkRequiredParametersAreSpecified
protected void checkRequiredParametersAreSpecified() throws org.apache.maven.plugin.MojoFailureExceptionPerforms some validation after the properties file has been loaded checking that all properties required have been specified.- Throws:
org.apache.maven.plugin.MojoFailureException- If any property that is required has not been specified.
-
databaseConnectionRequired
public boolean databaseConnectionRequired()Optionally, an implementation of this mojo can override this to indicate that a connection to the database is not required. -
printSettings
Prints the settings that have been set of defaulted for the plugin. These will only be shown in verbose mode.- Parameters:
indent- The indent string to use when printing the settings.
-
cleanup
-
parsePropertiesFile
protected void parsePropertiesFile(InputStream propertiesInputStream) throws org.apache.maven.plugin.MojoExecutionException Parses a properties file and sets the associated fields in the plugin.- Parameters:
propertiesInputStream- The input stream which is the Liquibase properties that needs to be parsed.- Throws:
org.apache.maven.plugin.MojoExecutionException- If there is a problem parsing the file.
-
getLog
public org.apache.maven.plugin.logging.Log getLog()- Specified by:
getLogin interfaceorg.apache.maven.plugin.Mojo- Overrides:
getLogin classorg.apache.maven.plugin.AbstractMojo
-
getOutputStream
Returns the OutputStream based on whether there is an outputFile provided. If no outputFile parameter is provided, defaults to System.out.- Parameters:
outputFile- the string outputFile- Returns:
- the OutputStream to use
- Throws:
LiquibaseException- if we cannot create the provided outputFile
-