Setup LiquiBase in a Gradle Spring Boot Hibernate project
I know this is an old thread, but I wanted to add some clarification for those who find this answer later...
The liquibaseRuntime
configuration does not inherit from any other configuration. This is because in most cases, Liquibase only needs to be able to parse the change logs and connect to the database. To use something like the Hibernate module, or to generate change logs from your code, you need to add extra things to the liquibaseRuntime, such as Hibernate or Spring Data, and you'd need srcSets.main.output
to be able to find your project files themselves.
The comment that said "All of your normal project dependencies would be here in addition to..." referred to the fact that you would have a bunch of other dependencies in the block to build and run your project, not that they would be part of the liquibaseRuntime
configuration. If you do want all of the libraries from your project to also be part of the liquibaseRuntime
, you can add configurations.liquibaseRuntime.extendsFrom configurations.runtime
you your build.gradle, or if you already have a configurations
block, you can add liquibaseRuntime.extendsFrom runtime
to that block. This should add all the project dependencies, and the project files themselves, to your liquibaseRuntime.
I hope this helps.
Turns out I needed to add some undocumented magic sauce.
diff.dependsOn compileJava
diffChangeLog.dependsOn compileJava
generateChangelog.dependsOn compileJava
dependencies {
// as before
liquibaseRuntime sourceSets.main.output // replaces liquibaseRuntime files('src/main')
}