Skip to content
Advertisement

Liquibase plugin for gradle

I’ve been looking for a liquibase gradle plugin and found gradle-liquibase-plugin from tlberglund.

Gradle version 1.2

build file:

apply plugin: 'java'
apply plugin: 'liquibase'

repositories {
    mavenCentral()
}

dependencies {
    compile('org.hsqldb:hsqldb:2.2.8')
    compile('org.hsqldb:sqltool:2.2.8')
    compile('com.h2database:h2:1.3.167')
    compile('org.liquibase:liquibase-core:2.0.1')
    compile('com.augusttechgroup:groovy-liquibase-dsl:0.7.3')
    compile('postgresql:postgresql:9.1-901.jdbc4')
}

buildscript {
    dependencies {
        classpath 'com.augusttechgroup:gradle-liquibase-plugin:0.6.1'
    }
}

databases {
    postgre {
        url = "${postgreBaseUrl}" + "${postgreDB}"
        username = "${postgreUserName}"
        password = "${postgreUserPassword}"
    }
}

changelogs {
    main {
        file = file('src/main/liquibase/mainChanges.groovy')
    }
}

task dbInit << {
    databases.postgre.url = "${postgreBaseUrl}"
    databases.postgre.username = "${postgreRootUserName}"
    databases.postgre.password = "${postgreRootUserPassword}"
    changelogs.main.file = file('src/main/liquibase/tablespaceChanges.groovy')
}

Runnin gradle build fails with the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':classpath'.
> Could not find group:com.augusttechgroup, module:gradle-liquibase-plugin, vers
ion:0.6.1.
  Required by:
      :demo:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to
get more log output.

BUILD FAILED

Does anyone have experience with this plugin, I would really appreciate a working example.

Advertisement

Answer

The problem isn’t related to the Liquibase plugin. You just need to declare a repository in the buildscript {} section. buildscript {} is completely separate from the rest of the script. You can almost think about it as a separate file.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement