Git Product home page Git Product logo

Comments (1)

stevesaliman avatar stevesaliman commented on July 25, 2024

Your custom task is actually completely separate from the Liquibase Gradle plugin. Your task uses JavaExec to run Liquibase as if you had run it from the command line. The best documentation to follow would be here: http://www.liquibase.org/documentation/command_line.html. If you want to keep your task the way it is, --diffExcludeObjects should become excludeObjects=DATABASECHANGELOG (if you're using the default table). This option is helpfully excluded from the official documentation...

There is another way that does use the plugin. You could have a liquibase block in your build.gradle that looks like this:

liquibase {
  activities {
    main {
      changeLogFile 'src/main/db/main.groovy'
      url project.ext.mainUrl
      username project.ext.mainUsername
      password project.ext.mainPassword
    }
    diffMain {
      changeLogFile 'src/main/resources/db.changelog/db.changelog-master.yaml'
      referenceUrl 'hibernate:spring:demoLiquibaseGit.domain.entity?dialect=org.hibernate.dialect.MySQL5Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'
      username project.ext.mainUsername
      password  project.ext.mainPassword
      url 'jdbc:mariadb://localhost:3306/db?useUnicode=yes&characterEncoding=UTF-8'
      referenceDriver 'liquibase.ext.hibernate.database.connection.HibernateDriver'
      excludeObjects 'DATABASECHANGELOG'
    }
  }
  runList = project.ext.runList
}

You'd probably also want runList=main in gradle.properties so that by default it only runs normal Liquibase tasks. You could then run your diff with gradle diff -PrunList=diffMain

Two things to keep in mind:

  1. The method names inside an activity, like url or username are a direct match to the comnand line arguments of Liquibase.
  2. There is nothing special about activity names. I use main and diffMain but you can call them whatever you want, as long as you reference them correctly in the runList.

I hope this helps.

from liquibase-gradle-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.