Liquibase Gradle-Plugin Konfiguration

Damit man JPABuddy nicht für die Generierung von Changelogs verwenden muss, sollte das Gradle Plugin von Liquibase eingebunden werden. Ich habe mal einen lauffähigen Prototypen, müsste aber noch optimiert werden:

build.gradle

buildscript {
    repositories {
        gradlePluginPortal()
    }

    // Eva
    dependencies {
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.1'
    }
}

plugins {
    id 'org.springframework.boot' version '3.0.4'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'

    // Eva
    id "com.google.protobuf" version "0.9.1"

    id 'org.liquibase.gradle' version '2.2.0'
}

group = 'de.hsrm.sls'
version = '2.0.0-beta15-SNAPSHOT'

repositories {
    mavenCentral()
    jcenter()

    maven {
        // library for accessing misconception definitions
        // https://gitlab.cs.hs-rm.de/sls/misclib
        url 'https://gitlab.cs.hs-rm.de/api/v4/projects/6030/packages/maven'
    }
}


dependencies {
    // springdoc (swagger)
    implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

    // javadoc generation for springdoc
    annotationProcessor 'com.github.therapi:therapi-runtime-javadoc-scribe:0.15.0'
    compileOnly 'com.github.therapi:therapi-runtime-javadoc:0.15.0'

    // spring
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.security:spring-security-data'
    implementation 'org.springframework.security:spring-security-test'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    implementation 'org.springframework.boot:spring-boot-starter-tomcat'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    implementation 'org.springframework.boot:spring-boot-starter-cache'

    // jgit - synchronization of task pools
    implementation 'org.eclipse.jgit:org.eclipse.jgit:6.3.0.202209071007-r'

    // verify that API classes are correctly annotated
    implementation 'org.reflections:reflections:0.9.12'

    // mime type detection
    implementation group: 'org.apache.tika', name: 'tika-core', version: '2.6.0'

    // markdown support for exercise/task/course descriptions
    implementation 'org.commonmark:commonmark:0.21.0'
    implementation 'org.commonmark:commonmark-ext-gfm-tables:0.21.0'
    implementation 'org.commonmark:commonmark-ext-gfm-strikethrough:0.21.0'

    // extracting zip files and other archive types for handling submitted solutions and task uploads/imports
    implementation 'net.lingala.zip4j:zip4j:2.11.2'
    implementation 'org.rauschig:jarchivelib:1.2.0'

    // database
    runtimeOnly 'org.postgresql:postgresql' // prod
    testImplementation 'com.h2database:h2'; // testsuite
    // database migrations
    implementation 'org.liquibase:liquibase-core:4.21.1'
    liquibaseRuntime 'org.liquibase:liquibase-core:4.21.1'
    liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:3.0.2'
    liquibaseRuntime 'info.picocli:picocli:4.6.1'
    liquibaseRuntime 'org.yaml:snakeyaml:1.17'
    liquibaseRuntime 'org.postgresql:postgresql'
    liquibaseRuntime 'org.springframework.boot:spring-boot-starter-data-jpa'
    liquibaseRuntime 'org.springframework.boot:spring-boot-starter-web'
    liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate6:4.21.1'
    liquibaseRuntime sourceSets.main.output
    liquibaseRuntime sourceSets.main.runtimeClasspath

    // static typing for JPA queries (specifications)
    annotationProcessor 'org.hibernate:hibernate-jpamodelgen:6.1.7.Final'

    // communication with Eva for evaluating solutions
    implementation 'com.google.protobuf:protobuf-javalite:3.8.0'
    implementation group: 'io.grpc', name: 'grpc-all', version: '1.25.0'
    // https://github.com/grpc/grpc-java/issues/9179
    implementation 'javax.annotation:javax.annotation-api:1.3.2'

    // Mapping entities to DTOs
    compileOnly "org.mapstruct:mapstruct:1.5.2.Final"
    annotationProcessor "org.mapstruct:mapstruct-processor:1.5.2.Final"

    // monitoring
    runtimeOnly 'io.micrometer:micrometer-registry-prometheus'

    // rate limiting
    implementation 'com.giffing.bucket4j.spring.boot.starter:bucket4j-spring-boot-starter:0.9.0-RC2'

    // caching
    implementation 'com.github.ben-manes.caffeine:jcache:3.1.5'

    // test
    implementation("org.junit.platform:junit-platform-suite:1.9.1")

    // misconceptions (research, not a prod-feature)
    implementation 'de.hsrm.sls.subato:misclib:3478a78cd97d-SNAPSHOT'

    // util
    implementation 'commons-io:commons-io:2.11.0'

    //implementation 'org.thymeleaf:thymeleaf-spring6'
}

test {
    useJUnitPlatform()
}

// Eva
sourceSets {
    main {
        java {
            srcDirs 'build/generated/source/proto/main/grpc'
            srcDirs 'build/generated/source/proto/main/java'
        }
    }
}

// Eva
protobuf {
    protoc {
        // Download from repositories
        artifact = 'com.google.protobuf:protoc:3.0.0'
    }

    plugins {
        grpc {
            artifact = 'io.grpc:protoc-gen-grpc-java:1.25.0'
        }
    }

    generateProtoTasks {
        all()*.plugins {
            grpc {}
        }
    }
}

def props = new Properties()
file("src/main/resources/application.properties").withInputStream { props.load(it) }

diff.dependsOn assemble
diffChangelog.dependsOn assemble

liquibase {
    activities {
        main {
            changeLogFile 'src/main/resources/db/changelog/db.changelog-master.yaml'
            referenceUrl 'hibernate:spring:de.hsrm.sls.subato.?dialect=org.hibernate.dialect.PostgreSQL9Dialect'
            url 'jdbc:postgresql://localhost:5434/subato2'
            username 'sep'
            password 'wl1npon'
            driver 'org.postgresql.Driver'
            referenceDriver "liquibase.ext.hibernate.database.connection.HibernateDriver"
        }
    }
}