【发布时间】:2020-04-04 05:32:42
【问题描述】:
伙计们,我在 Spring Boot 项目中使用了 flyway。
当我启动应用程序时,迁移脚本会正确执行。
我的迁移在文件夹中:
flyway.locations = db/migration/postgresql
当我尝试从配置文件执行 fyway 插件 maven 的某些目的时,会出现问题。
配置文件:
flyway.password=root
flyway.schemas=public
flyway.url=jdbc:postgresql://localhost:5432/film
flyway.locations=db/migration/postgresql
运行maven命令:
mvn flyway: 修复-Flyway.config File = myFlywayConfig.properties
返回错误:
未能执行目标 org.flywaydb:flyway-maven-plugin:6.1.0:repair (default-cli) 在项目 demo-hibernate-envers 上: org.flywaydb.core.api.FlywayException:未知的配置属性: flyway.config文件
但是当我通过 pom.xml 配置 flyway 插件并运行命令时:
mvn flyway:repair
一切正常
flyway插件配置下方:
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>6.1.0</version>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<configuration>
<user>postgres</user>
<password>root</password>
<url>jdbc:postgresql://localhost:5432/film</url>
<schemas>
<schema>public</schema>
</schemas>
</configuration>
</plugin>
有谁知道如何根据外部配置完成flyway插件的目标?
【问题讨论】:
-
您需要在运行时覆盖 maven 插件的配置值。请检查:stackoverflow.com/questions/35048422/…
标签: java spring postgresql spring-boot flyway