Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

230
Views
How to run Flyway migrate before jOOQ code generation using Spring Boot?

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.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!