[英]Flyway and gradle kotlin dsl
I'm migrating from Gradle to Gradle Kotlin DSL, and I have a question. 我正在从Gradle迁移到Gradle Kotlin DSL,我有一个问题。 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? 您如何看待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: 该块中的代码在Kotlin中与Groovy几乎完全相同,但上面有两个例外:
arrayOf
instead of [...]
for the array for the locations
property. arrayOf
而不是[...]
用于locations
属性的数组。 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: 请记住,要使构建文件了解
flyway
功能(并让IDE flyway
告知您块中可用的选项,等等),您需要使用Gradle Plugins DSL应用Flyway插件,如下所示: build.gradle.kts
文件的顶部:
plugins {
id("org.flywaydb.flyway") version "5.2.4"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.