无法将 Spring Boot 应用升级到 Flyway 7.0.0
2022-09-04 19:31:00
我正在尝试升级我的Spring Boot 2.3.4应用程序以使用Flyway 7.0.0(最新版本)。以前它使用的是Flyway 6.5.6。中的相关条目如下所示。build.gradle
buildscript {
ext {
flywayVersion = "7.0.0" // changed from 6.5.6
}
}
plugins {
id "org.flywaydb.flyway" version "${flywayVersion}"
}
dependencies {
implementation "org.flywaydb:flyway-core:${flywayVersion}"
}
flyway {
url = "jdbc:postgresql://0.0.0.0:5432/postgres"
user = "postgres"
password = "secret"
}
当我启动应用程序时发生以下错误,例如./gradlew bootRun
应用程序启动失败
描述:
尝试调用不存在的方法。尝试是从以下位置进行的:
org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:65)
以下方法不存在:
'int org.flywaydb.core.Flyway.migrate()'
该方法的类 org.flywaydb.core.Flyway 可从以下位置获得:
jar:file:/Users/antonio/.gradle/caches/modules-2/files-2.1/org.flywaydb/flyway-core/7.0.0/623494c303c62080ca1bc5886098ee65d1a5528a/flyway-core-7.0.0.jar!/org/flywaydb/core/Flyway.class
类层次结构是从以下位置加载的:
org.flywaydb.core.Flyway: file:/Users/antonio/.gradle/caches/modules-2/files-2.1/org.flywaydb/flyway-core/7.0.0/623494c303c62080ca1bc5886098ee65d1a5528a/flyway-core-7.0.0.jar
行动:
更正应用程序的类路径,使其包含 org.flywaydb.core.Flyway 的单个兼容版本