I'm migrating from Gradle to Gradle Kotlin DSL, and I have a question. Have
flyway {
url = System.getenv ('DB_URL')
user = System.getenv ('DB_USER')
password = System.getenv ('DB_PASSWORD')
baselineOnMigrate = true
locations = ["filesystem: resources / db / migration"]
}
In Gradle.
How would you look in Kotlin DSL?
The code in the block is almost exactly the same in Kotlin as in Groovy, with two exceptions for what you have above:
arrayOf
instead of [...]
for the array for the locations
property.In other words it would look as follows:
flyway {
url = System.getenv("DB_URL")
user = System.getenv("DB_USER")
password = System.getenv("DB_PASSWORD")
baselineOnMigrate = true
locations = arrayOf("filesystem: resources / db / migration")
}
Bear in mind that for the build file to understand the flyway
function (and for the IDE to give you intellisense for what options are available in the block, etc.) you need to apply the Flyway plugin using the Gradle Plugins DSL, as follows at the top of your build.gradle.kts
file:
plugins {
id("org.flywaydb.flyway") version "5.2.4"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With