spring boot 在 IntelliJ 启动时未找到 liquibase

问题描述 投票:0回答:1

我正在 IntelliJ 14 中使用 Liquibase 运行 Spring 1.2.1.RELEASE:

构建.等级

compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion")
 compile('org.liquibase:liquibase-core')

我有一个 project/config/application.properties,我用它来告诉 Liquibase 创建数据库并插入数据:

spring.jpa.hibernate.ddl-auto=none

spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.database=POSTGRESQL   
spring.jpa.hibernate.hbm2ddl.auto=none
spring.jpa.hibernate.disableConnectionTracking=true
spring.jpa.hibernate.default_schema=xxx

liquibase.change-log:classpath:/db/changelog/db.changelog-master.xml
liquibase.check-change-log-location=true

如果我从命令行运行:

gradle clean build

我将按预期在数据库中获取所有表格和种子数据。但是,如果我从 IntelliJ 中运行主 SpringBoot 应用程序类,则不会创建任何表。我有一个日志文件,显示从命令行使用 liquibase,但是当我从 IntelliJ 中运行时,该日志文件中没有提及 Liquibase。可以肯定的是,我在 project/src/resources 下有一个重复的 application.properites。

这是我的项目在 IntelliJ 中的外观: enter image description here

关于如何获取 IntelliJ 中使用的属性文件有什么想法吗?

intellij-idea spring-boot
1个回答
0
投票

我遇到了同样的问题,并更新了 liquibase 依赖项,如下解决了我的问题:

    // ---------------------------------------------------------------------
    // LIQUIBASE DEPS
    // ---------------------------------------------------------------------
    'org.liquibase:liquibase-gradle-plugin:2.2.1',
    'org.liquibase:liquibase-core:4.27.0',
    'org.liquibase:liquibase-groovy-dsl:3.0.3',
© www.soinside.com 2019 - 2024. All rights reserved.