All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.liquibase.maven.plugins.LiquibaseSyncHubMojo Maven / Gradle / Ivy

There is a newer version: 4.30.0
Show newest version
package org.liquibase.maven.plugins;

import liquibase.Liquibase;
import liquibase.command.CommandScope;
import liquibase.command.core.InternalSyncHubCommandStep;
import liquibase.database.Database;
import liquibase.exception.LiquibaseException;
import org.apache.maven.plugin.MojoFailureException;
import org.liquibase.maven.property.PropertyElement;

import java.util.UUID;

/**
 * 

Syncs all changes in change log with Hub.

* * @author Wesley Willard * @goal syncHub */ public class LiquibaseSyncHubMojo extends AbstractLiquibaseChangeLogMojo { /** * Specifies the Liquibase Hub Connection ID for Liquibase to use. * * @parameter property="liquibase.hubConnectionId" */ @PropertyElement protected String hubConnectionId; /** * Specifies the Liquibase Hub API key for Liquibase to use. * * @parameter property="liquibase.hubProjectId" */ @PropertyElement protected String hubProjectId; @Override protected void checkRequiredParametersAreSpecified() throws MojoFailureException { // // Override because changeLogFile is not required // } @Override protected void performLiquibaseTask(Liquibase liquibase) throws LiquibaseException { super.performLiquibaseTask(liquibase); Database database = liquibase.getDatabase(); CommandScope syncHub = new CommandScope(InternalSyncHubCommandStep.COMMAND_NAME); syncHub .addArgumentValue(InternalSyncHubCommandStep.CHANGELOG_FILE_ARG, changeLogFile) .addArgumentValue(InternalSyncHubCommandStep.URL_ARG, database.getConnection().getURL()) .addArgumentValue(InternalSyncHubCommandStep.HUB_CONNECTION_ID_ARG, (hubConnectionId != null ? UUID.fromString(hubConnectionId) : null)) .addArgumentValue(InternalSyncHubCommandStep.HUB_PROJECT_ID_ARG, (hubProjectId != null ? UUID.fromString(hubProjectId) : null)) .addArgumentValue(InternalSyncHubCommandStep.DATABASE_ARG, database) .addArgumentValue(InternalSyncHubCommandStep.FAIL_IF_OFFLINE_ARG, false); syncHub.execute(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy