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

liquibase.integration.ant.ChangeLogSyncTask Maven / Gradle / Ivy

There is a newer version: 4.29.2
Show newest version
package liquibase.integration.ant;

import liquibase.Liquibase;
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.BuildException;

import java.io.Writer;

public class ChangeLogSyncTask extends BaseLiquibaseTask {

    @Override
    public void execute() throws BuildException {
        super.execute();

        if (!shouldRun()) {
            return;
        }

        Liquibase liquibase = null;
        try {
            liquibase = createLiquibase();

            Writer writer = createOutputWriter();
            if (writer == null) {
                liquibase.changeLogSync(getContexts());
            } else {
                liquibase.changeLogSync(getContexts(), writer);
                writer.flush();
                writer.close();
            }

        } catch (Exception e) {
            throw new BuildException(e);
        } finally {
            closeDatabase(liquibase);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy