Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to ugrade a Spring Boot app to Flyway 7.0.0

I'm trying to upgrade my Spring Boot 2.3.4 app to use Flyway 7.0.0 (the latest version). Previously it was using Flyway 6.5.6. The relevant entries in build.gradle are shown below.

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"
}

The following error occurs when I start the app e.g. with ./gradlew bootRun


APPLICATION FAILED TO START


Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:65)

The following method did not exist:

'int org.flywaydb.core.Flyway.migrate()'

The method's class, org.flywaydb.core.Flyway, is available from the following locations:

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

The class hierarchy was loaded from the following locations:

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

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.flywaydb.core.Flyway

like image 706
Antonio Dragos Avatar asked Oct 02 '20 14:10

Antonio Dragos


People also ask

What is Flyway used for in spring boot?

Using Flyway with Spring Boot Flyway is another open-source library used for Database Migration / Version Control for the DB scripts. It allows us to migrate the changes to DB incrementally by versioning and it supports migrations in SQL or Java migration ( for advanced data transformations or dealing with LOB).

What is the latest version of spring boot?

What is the latest Spring Boot version? The current stable version, as of July 2022, is Spring Boot 2.7. 1.


1 Answers

Basically, see Philip's comment on your question.

Flyway 7.x.x is not currently compatible with Spring Boot 2.3.4

Temporary solution is to just downgrade to Flyway 6.5.7 (the last 6.x.x version) until Spring Boot 2.3.5 is released.

Read more and follow the issue here: https://github.com/spring-projects/spring-boot/issues/23514

Support for Flyway's new configuration options: https://github.com/spring-projects/spring-boot/issues/23579

like image 75
Georgian Avatar answered Sep 20 '22 11:09

Georgian