Here's my Gradle file using liquibase-gradle-plugin in Groovy DSL:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.liquibase:liquibase-core:3.4.1'
classpath 'org.liquibase:liquibase-gradle-plugin:2.0.1'
classpath 'org.postgresql:postgresql:42.2.5'
}
}
apply plugin: 'liquibase'
repositories {
mavenCentral()
}
dependencies {
liquibaseRuntime 'org.liquibase:liquibase-core:3.4.1'
liquibaseRuntime 'org.liquibase:liquibase-gradle-plugin:2.0.1'
liquibaseRuntime 'org.postgresql:postgresql:42.2.5'
}
task('dev') {
doLast {
println "executing dev"
liquibase {
activities {
main {
changeLogFile 'C:\\Users\\redacted\\IdeaProjects\\Food\\src\\main\\resources\\changelog.xml'
url 'jdbc:postgresql://localhost/mydb'
username 'postgres'
password 'redacted'
}
}
}
println "Done running dev."
}
}
Here's my attempt at converting the file over to Kotlin DSL instead:
plugins {
id("org.liquibase.gradle") version "2.0.1"
}
repositories {
mavenCentral()
}
dependencies {
compile("org.liquibase:liquibase-core:3.4.1")
compile("org.liquibase:liquibase-gradle-plugin:2.0.1")
compile("org.postgresql:postgresql:42.2.5")
add("liquibaseRuntime", "org.liquibase:liquibase-core:3.4.1")
add("liquibaseRuntime", "org.liquibase:liquibase-gradle-plugin:2.0.1")
add("liquibaseRuntime", "org.postgresql:postgresql:42.2.5")
}
tasks.register("dev") {
doLast {
println("executing dev")
"liquibase" {
"activities" {
"main" {
"changeLogFile"("C:\\Users\\redacted\\IdeaProjects\\Food\\src\\main\\resources\\changelog.xml")
"url"("jdbc:postgresql://localhost/mydb")
"username"("postgres")
"password"("redacted")
}
}
}
println("Done running dev")
}
}
It all falls apart at the line "liquibase". I'm not familiar enough with Gradle - in the groovy version of the file, how is liquibase being resolved? What is it resolving to - is it a function? How do I get it to be resolved the same in the Kotlin version? Then under that, I'll also need to resolve activities, main, changeLogFile, url, username, and password...