2

I have a gradle multi module spring boot project.

My build.gradle file:

apply plugin: 'org.springframework.boot'
apply plugin: 'org.liquibase.gradle'

dependencies {
    liquibaseRuntime 'org.liquibase:liquibase-core:4.22.0'
    liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:3.0.0'
    liquibaseRuntime 'org.postgresql:postgresql:42.3.8'
    liquibaseRuntime 'info.picocli:picocli:4.7.3'
    liquibaseRuntime 'org.yaml:snakeyaml:2.0'
    liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate5:4.22.0'
    ...

    }

liquibase {
    activities {
        main {
            classpath 'src/main/resources'
            changeLogFile 'src/main/resources/db/changelog/db.changelog-master.yaml'
            url 'jdbc:postgresql://localhost:5432/dbname'
            username 'postgres'
            password 'postgres'
            driver 'org.postgresql.Driver'
            referenceUrl     'hibernate:spring:com.test.test?    dialect=org.hibernate.dialect.PostgreSQL95Dialect&hibernate.physical_naming_strategy=org.    springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_na    ming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'
        }
    }
}

and plugins:

plugins {
    id 'java'
    id 'java-library'
    id 'application'
    id 'org.springframework.boot' version "$springBootVersion"
    id 'org.liquibase.gradle' version '2.2.0'
}

db.changelog-master.yaml file:

databaseChangeLog:
  - include:
      file: db/changelog/changes/first.groovy

My first.groovy file:

package db.changelog.changes

databaseChangeLog() {
    changeSet(id: 'create-schema', author: 'testowner') {
        sql(stripComments: true, splitStatements: false, endDelimiter: ';') {
            "CREATE TABLE public.test_entity (" +
                    "id bigserial NOT NULL);" 
        }
    }
}

My file structure:

src
 main
  resources
   db
    changelog
     changes
      first.groovy
     db.changelog-master.yaml

Java Sdk:

java 17.0.2 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)

java-config.gradle file:

apply plugin: 'java'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

And error liquibase update gives:

Caused by: liquibase.exception.ChangeLogParseException: Error parsing src/main/resources/db/changelog/db.changelog-master.yaml : Could not find matching constructor for: liquibase.changelog.ChangeSet(java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.String, null, null, null, java.lang.Boolean, null, liquibase.changelog.DatabaseChangeLog)
Mert Doe
  • 549
  • 5
  • 15
  • I think the used groovy (org.codehaus.groovy:groovy:2.4.12 in my case) version might be incompatible with Gradle 8+ and Java 17 I'm running into a similar issue currently. Can you maybe confirm this? – leonardkraemer Aug 24 '23 at 22:15
  • Probably upgrading to 'org.liquibase:liquibase-groovy-dsl:3.0.3' will help – leonardkraemer Aug 24 '23 at 22:22

0 Answers0