【问题标题】:Liquibase not running in Spring Boot Kotlin projectLiquibase 未在 Spring Boot Kotlin 项目中运行
【发布时间】:2020-01-02 13:26:09
【问题描述】:

我使用 Gradle 和 Kotlin 创建了一个 Spring Boot 项目,版本为 2.2.3.BUILD-SNAPSHOT。我也想用 liquibase,但我做不到。

使用相同的设置,但使用 Java,我可以使 liquibase 工作。

这是我的资源文件夹:

这些是我的依赖:

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.boot:spring-boot-starter-security")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("org.springframework.boot:spring-boot-starter-jdbc")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.liquibase:liquibase-core")
    runtimeOnly("org.postgresql:postgresql")
    testImplementation("org.springframework.boot:spring-boot-starter-test") {
        exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
    }
    testImplementation("org.springframework.security:spring-security-test")
}

【问题讨论】:

  • 您是否收到任何异常或错误消息?您的项目目录布局如何?您使用的是 Maven 还是 Gradle?您必须提供更多我们可以帮助您的信息
  • 我没有收到任何错误消息,我认为 liquibase 甚至没有尝试执行,而且我没有数据源。我正在使用 Gradle
  • “我没有数据源”是什么意思,请提供目录结构
  • 嗨,西蒙,感谢您的留言。我编辑了评论并附加了资源文件夹和 build.gradle.kts 中的依赖项

标签: spring-boot kotlin liquibase


【解决方案1】:

添加liquidbase依赖

implementation("org.liquibase:liquibase-core:3.8.2")

【讨论】:

  • 并且属性liquibase.enabled 具有值true
  • 那是 Spring boot 1. 如果我使用 Java 而不是 Kotlin,它可以工作
  • 你具体用的是什么版本的spring boot、kotlin和java?
猜你喜欢
  • 2019-05-30
  • 2019-01-27
  • 1970-01-01
  • 2019-03-02
  • 2018-11-29
  • 2018-10-12
  • 1970-01-01
  • 2021-07-26
  • 1970-01-01
相关资源
最近更新 更多