I'm trying to use Flyway and jOOQ together with Spring Boot (spring-boot-starter-jooq and autoconfigured Flyway both handled by Spring)
My problem is that the jOOQ code generation runs before Flyway migrate, so jOOQ doesn't see the changes made by Flyway.
I tried setting dependsOn for the jOOQ generator task to flywayMigrate but as it turns out Flyway is run only on startup. The Flyway Gradle plugin is not applied, so I have no flywayMigrate task.
When I tried adding it to my gradle config following the official Flyway guide:
apply plugin: "org.flywaydb.flyway"
flyway {
url = 'jdbc:postgresql://localhost:5432/myDb'
user = 'myUsr'
password = 'mySecretPwd'
schemas = ['public']
}
I get an exception:
java.lang.NoClassDefFoundError: org.flywaydb.core.internal.util.jdbc.DriverDataSource
What am I doing wrong? How do I set this up so they work together nicely?
Note that I have the PostgreSQL driver and Flyway Core as a dependency:
implementation "org.postgresql:postgresql:42.2.5"
implementation "org.flywaydb:flyway-core"
so it should work. This is probably a Gradle vs Flyway vs Spring issue, because Flyway works when I start up my Spring app.