revolut-engineering / jooq-plugin

Plugin for generating jOOQ classes using dockerized databases
Apache License 2.0
72 stars 29 forks source link

Jooq-Docker conflicts with the Flyway plugin #26

Open dmitry-cherkas opened 1 year ago

dmitry-cherkas commented 1 year ago

com.revolut.jooq-docker depends on the old org.flywaydb:flyway-core:6.4.3 version, which is causing the following warnings during the build time:

> Task :generateJooqClasses
Flyway upgrade recommended: PostgreSQL 14.5 is newer than this version of Flyway and support has not been tested. The latest supported version of PostgreSQL is 12.

Suggested resolution: upgrade the flyway-core dependency to a latest version (9.14.1 as of now).

dmitry-cherkas commented 1 year ago

Dependency on the old flyway-core is actually causing the plugin to fail, when used together with a fresh version of Gradle Flyway Plugin (org.flywaydb.flyway) due to a method signature update:

Caused by: java.lang.NoSuchMethodError: 'int org.flywaydb.core.Flyway.migrate()'
    at com.revolut.jooq.GenerateJooqClassesTask.migrateDb(GenerateJooqClassesTask.kt:169)
    at com.revolut.jooq.GenerateJooqClassesTask.access$migrateDb(GenerateJooqClassesTask.kt:23)
    at com.revolut.jooq.GenerateJooqClassesTask$generateClasses$$inlined$use$lambda$1.execute(GenerateJooqClassesTask.kt:153)
    at com.revolut.jooq.GenerateJooqClassesTask$generateClasses$$inlined$use$lambda$1.execute(GenerateJooqClassesTask.kt:23)
    at com.revolut.jooq.Docker.runInContainer(Docker.kt:40)
    at com.revolut.jooq.GenerateJooqClassesTask.generateClasses(GenerateJooqClassesTask.kt:152)

I have created a repo to reproduce the issue: https://github.com/dmitry-cherkas/jooq-docker-flyway/

It appears that the signature of org.flywaydb.core.Flyway.migrate() was changed to return org.flywaydb.core.api.output.MigrateResult instead of int.