Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle: How do I run my LIquibase changesets as part of my normal build process?

I'm using Gradle 2.7 with the Gradle Liquibase plugin v 1.1.1. How do I run my changeSets as part of doing my normal build using

gradle build

? I currently have this in my build.gradle file ...

liquibase {
  activities {
    main {
        File propsFile = new File("${project.rootDir}/src/main/resources/liquibase.properties")
      Properties properties = new Properties()
      properties.load(new FileInputStream(propsFile))
      changeLogFile 'src/main/resources/db.changelog-1.0.xmlll'
      url '${url}'
      username '${username}'
      password '${password}'
    }
    runList = main
  }
}

However when I run the above command ("gradle build"), the above is not run. I know its not run because the username/password are incorrect and I have no change log file ending in ".xmlll". WHat else do I need to add to assure that hte plugin always attempts to execute the changeset?

like image 708
Dave Avatar asked Oct 28 '25 15:10

Dave


1 Answers

You need to define a task dependency from build to update.

build.dependsOn update

To get task to run before your tests (assuming you didn't define a new one), you can do

test.dependsOn update

Ref:

  • Gradle task docs
like image 179
Ethan Avatar answered Oct 31 '25 07:10

Ethan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!