Class CleanMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.flywaydb.maven.CleanMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="clean", requiresDependencyResolution=TEST, defaultPhase=CLEAN, threadSafe=true) public class CleanMojo extends org.apache.maven.plugin.AbstractMojo
Maven goal that drops all database objects (tables, views, procedures, triggers, ...) in the configured schemas. The schemas are cleaned in the order specified by the schemas property..
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    The fully qualified classname of the JDBC driver to use to connect to the database.
    Whether to fail if a location specified in the flyway.locations option doesn't exist
    protected org.apache.maven.project.MavenProject
    Reference to the current project that includes the Flyway Maven plugin.
    protected org.apache.maven.settings.Settings
    The link to the settings.xml
    protected boolean
    Whether to skip the execution of the Maven Plugin for this module.
    protected String
    The JDBC url to use to connect to the database.
    protected String
    The user to use to connect to the database.

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doExecute(org.flywaydb.core.Flyway flyway)
    Executes this mojo.
    final void
     
    protected boolean
    getBooleanProperty(String systemPropertyName, boolean mavenPropertyValue)
    Retrieves the value of this boolean property, based on the matching System property on the Maven property.
    getPluginConfiguration(Map<String,String> pluginConfiguration)
     
    protected String
    Retrieves this property from either the system or the maven properties.

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • skip

      @Parameter(property="flyway.skip") protected boolean skip
      Whether to skip the execution of the Maven Plugin for this module.

      Also configurable with Maven or System Property: ${flyway.skip}

    • driver

      @Parameter(property="flyway.driver") protected String driver
      The fully qualified classname of the JDBC driver to use to connect to the database. By default, the driver is autodetected based on the url.

      Also configurable with Maven or System Property: ${flyway.driver}

    • url

      @Parameter(property="flyway.url") protected String url
      The JDBC url to use to connect to the database.

      Also configurable with Maven or System Property: ${flyway.url}

    • user

      @Parameter(property="flyway.user") protected String user
      The user to use to connect to the database. (default: blank) The credentials can be specified by user/password or serverId from settings.xml

      Also configurable with Maven or System Property: ${flyway.user}

    • failOnMissingLocations

      @Parameter(property="flyway.failOnMissingLocations") public Boolean failOnMissingLocations
      Whether to fail if a location specified in the flyway.locations option doesn't exist
    • settings

      @Parameter(defaultValue="${settings}", readonly=true) protected org.apache.maven.settings.Settings settings
      The link to the settings.xml
    • mavenProject

      @Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject mavenProject
      Reference to the current project that includes the Flyway Maven plugin.
  • Constructor Details

    • CleanMojo

      public CleanMojo()
  • Method Details

    • doExecute

      protected void doExecute(org.flywaydb.core.Flyway flyway)
      Executes this mojo.
      Parameters:
      flyway - The flyway instance to operate on.
    • getBooleanProperty

      protected boolean getBooleanProperty(String systemPropertyName, boolean mavenPropertyValue)
      Retrieves the value of this boolean property, based on the matching System property on the Maven property.
      Parameters:
      systemPropertyName - The name of the System property.
      mavenPropertyValue - The value of the Maven property.
    • execute

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

      public Map<String,String> getPluginConfiguration(Map<String,String> pluginConfiguration)
    • getProperty

      protected String getProperty(String name)
      Retrieves this property from either the system or the maven properties.
      Parameters:
      name - The name of the property to retrieve.
      Returns:
      The property value. null if not found.