Liquibase generate JPA entities diff springboot kotlin

Hello,

I think this question has been asked prior but I am having a hard time configuring liquibase to work with spring-boot-kotlin (gradle). I want to generate liquibase change-log and change-set files basing on JPA entities - the requirement is to define all the entities (and subsequent entity changes as well) via liquibase gradle-diff or gradle-generate-chanelog tasks (so we can integrate as part of CI). So far, I am having a very hard time trying to get this going, feels like the gradle plugin is a bit obscure to configure or maybe liquibase doesn’t offer this functionality at all ?

Our though process is that, we want to use liquibase as a migration and schema management/versioning tool.The initial database schema would be empty. We then want to leverage lquibase to generate the initial change-log file and keep updating (via diff task or generate-chane-log tasks), each time we make entity definition changes. The idea here is to integrate these steps as part of CI.

Here’s my configuration (liquibase.properties) -

classpath=src/main/resources
# output-file=src/main/resources/db/db.changelog-master.yaml
changelog-file=src/main/resources/db/db.changelog-master.yaml
url=jdbc:mysql://localhost:3306/schema_test
driver=com.mysql.cj.jdbc.Driver
username=****
password=****
referenceUrl=hibernate:spring:com.sendbird.messaging.moderationengine.entities\
  ?dialect=org.hibernate.dialect.MySQLDialect&hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl\
  &hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
referenceDriver=liquibase.ext.hibernate.database.connection.HibernateDriver

Here’s the gradle file -


plugins {
  id("org.liquibase.gradle") version "2.2.0"
  kotlin("jvm") version "1.8.0"
  kotlin("plugin.spring") version "1.8.0"
  kotlin("plugin.jpa") version "1.8.0"
}

dependencies {
  liquibaseRuntime("org.liquibase:liquibase-core:4.20.0")
  liquibaseRuntime("org.liquibase.ext:liquibase-hibernate6:4.20.0")
  liquibaseRuntime("info.picocli:picocli:4.7.3")
  liquibaseRuntime("mysql:mysql-connector-java:8.0.32")
  liquibaseRuntime("org.springframework.boot:spring-boot-starter-data-jpa")
  liquibaseRuntime("org.springframework:spring-beans")
  // liquibaseRuntime(files("build/classes/kotlin/main"))
  // liquibaseRuntime(files("build/resources/main"))

  runtimeOnly("mysql:mysql-connector-java:8.0.32")
}

Any luck? I’m in middle of the similar project.