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 Boolean
Enable or disable sending product usage data and analytics to Liquibase.protected String
Specifies the fully qualified class name of the custom ChangeExecListenerprotected String
Specifies the property file for controlling the custom ChangeExecListenerprotected String
Specifies the schema Liquibase will use to create your changelog tables.protected String
Specifies the schema Liquibase will use to create your changelog table.protected boolean
A flag that forces checksums to be cleared from the DATABASECHANGELOG table.protected String
protected String
Specifies the table name to use for the DATABASECHANGELOGLOCK table.protected String
Specifies the table name to use for the DATABASECHANGELOG table.protected String
Specifies the database object class.protected String
Specifies the default catalog name to use for the database connection.protected DefaultChangeExecListener
protected String
Specifies the default schema name to use for the database connection.protected String
Specifies the driver class name to use for the database connection.protected boolean
Deprecated.Use an empty or null value for the password instead.protected boolean
Includes a Maven project artifact in the class loader which obtains the liquibase.properties and changelog files.protected boolean
Includes the Maven test output directory in the class loader which obtains the liquibase.properties and changelog files.protected String
Deprecated.Logging managed by mavenprotected String
Determines the minimum log level liquibase uses when logging.protected org.apache.maven.plugin.MojoExecution
protected boolean
Specifies whether to ignore the catalog/database name.protected boolean
Specifies whether to ignore the schema name.protected String
A flag which indicates you want to set the character encoding of the output file during the updateSQL phase.protected String
Specifies the database password for database connection.protected Boolean
Specifies whether to preserve the case of schemas and catalogsprotected org.apache.maven.project.MavenProject
The Maven project that plugin is running under.protected boolean
Deprecated.No longer promptsprotected String
Specifies the liquibase.properties you want to use to configure Liquibase.protected boolean
A flag which indicates you want the liquibase.properties file to override any settings provided in the Maven plugin configuration.protected String
Specifies the property provider which must be a java.util.Properties implementation.protected String
Specifies the locations where Liquibase can find your changelog files.protected org.apache.maven.execution.MavenSession
protected boolean
Show the liquibase banner in output.protected boolean
Specifies whether to skip running Liquibase.protected String
Skip plugin execution if the specified file exists.protected Boolean
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.protected Properties
Specifies a list of system properties you want to pass to the database.protected String
Specifies the database URL you want to use to execute Liquibase.protected String
Specifies the database username for database connection.protected boolean
Controls the amount of output detail when you call the plugin.protected org.apache.maven.artifact.manager.WagonManager
The 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 void
Performs some validation after the properties file has been loaded checking that all properties required have been specified.protected void
protected void
void
protected Liquibase
boolean
Optionally, an implementation of this mojo can override this to indicate that a connection to the database is not required.void
execute()
protected ClassLoader
Returns an isolated classloader.protected Field
protected Liquibase
org.apache.maven.plugin.logging.Log
getLog()
protected ClassLoader
protected OutputStream
getOutputStream
(String outputFile) Returns the OutputStream based on whether there is an outputFile provided.protected Writer
getOutputWriter
(File outputFile) protected ResourceAccessor
protected boolean
Deprecated.no longer promptsprotected void
parsePropertiesFile
(InputStream propertiesInputStream) Parses a properties file and sets the associated fields in the plugin.protected abstract void
performLiquibaseTask
(Liquibase liquibase) protected void
printSettings
(String indent) Prints the settings that have been set of defaulted for the plugin.protected void
Methods 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 thepassword
setting. -
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.MojoExecutionException
org.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.MojoFailureException
org.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:
IOException
org.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:
getLog
in interfaceorg.apache.maven.plugin.Mojo
- Overrides:
getLog
in 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
-