From cc05be3e25de49a7171683c3dc8e0a75fb049a13 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 4 Nov 2023 19:36:32 +0100 Subject: [PATCH] fix: Update dependency org.flywaydb:flyway-core to v10 (#153) BREAKING CHANGE: Flyway 10.0.0 doesn't include Postgres plugin in the `core` artifact anymore Whenever you provide another Flyway version via `jooqCodegen` configuration, make sure to include `org.flywaydb:flyway-database-postgresql` dependency in addition to `org.flywaydb:flyway-core`, otherwise you might get an error like this: ``` org.flywaydb.core.api.FlywayException: No database found to handle jdbc:postgresql://localhost:32798/postgres ``` --- README.md | 2 ++ build.gradle.kts | 2 +- .../src/main/kotlin/coverage-convention.gradle.kts | 12 ++++++++++++ .../submodule-classes/migrations/build.gradle.kts | 2 +- .../migrations/build.gradle.kts | 2 +- libs.versions.toml | 9 ++++++++- ...ionConfigurationJooqDockerPluginFunctionalTest.kt | 3 ++- .../functional/JavaBasedMigrationsFunctionalTest.kt | 2 +- ...ultipleDatabasesJooqDockerPluginFunctionalTest.kt | 1 + .../jooq/functional/NoMigrationsFunctionalTest.kt | 1 + 10 files changed, 30 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 21e83e6..7026088 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ dependencies { implementation("org.jooq:jooq:${RecommendedVersions.JOOQ_VERSION}") jooqCodegen("org.postgresql:postgresql:42.3.6") jooqCodegen("org.flywaydb.enterprise:flyway-core:${RecommendedVersions.FLYWAY_VERSION}") + jooqCodegen("org.flywaydb:flyway-database-postgresql:${RecommendedVersions.FLYWAY_VERSION}") } ``` @@ -411,6 +412,7 @@ dependencies { jooqCodegen("org.postgresql:postgresql:42.3.6") jooqCodegen("mysql:mysql-connector-java:8.0.29") jooqCodegen("org.flywaydb:flyway-mysql:${RecommendedVersions.FLYWAY_VERSION}") + jooqCodegen("org.flywaydb:flyway-database-postgresql:${RecommendedVersions.FLYWAY_VERSION}") implementation("org.jooq:jooq:3.16.6") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 8f4fec3..0e71ada 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,7 +43,7 @@ dependencies { * transitive. This is a quirk of the shadow plugin. */ shadow(libs.jooq.codegen) - shadow(libs.flyway.core) + shadow(libs.bundles.flyway) implementation(libs.testcontainers.jdbc) { exclude(group = libs.jna.get().group) // cannot be shadowed diff --git a/buildSrc/src/main/kotlin/coverage-convention.gradle.kts b/buildSrc/src/main/kotlin/coverage-convention.gradle.kts index bbd1445..36fa177 100644 --- a/buildSrc/src/main/kotlin/coverage-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/coverage-convention.gradle.kts @@ -1,3 +1,6 @@ +import java.lang.Thread.sleep +import java.time.Duration + plugins { kotlin("jvm") jacoco @@ -12,4 +15,13 @@ tasks { } dependsOn(withType()) } + + withType { + // workaround for https://github.com/gradle/gradle/issues/16603 + doLast { + sleep( + Duration.ofSeconds(2).toMillis() + ) + } + } } diff --git a/examples/java-based-migrations/submodule-classes/migrations/build.gradle.kts b/examples/java-based-migrations/submodule-classes/migrations/build.gradle.kts index c54e860..02fefca 100644 --- a/examples/java-based-migrations/submodule-classes/migrations/build.gradle.kts +++ b/examples/java-based-migrations/submodule-classes/migrations/build.gradle.kts @@ -10,5 +10,5 @@ repositories { } dependencies { - implementation("org.flywaydb:flyway-core:$FLYWAY_VERSION") + compileOnly("org.flywaydb:flyway-core:$FLYWAY_VERSION") } diff --git a/examples/java-based-migrations/submodule-dependency-configuration/migrations/build.gradle.kts b/examples/java-based-migrations/submodule-dependency-configuration/migrations/build.gradle.kts index fde4cfa..233db2a 100644 --- a/examples/java-based-migrations/submodule-dependency-configuration/migrations/build.gradle.kts +++ b/examples/java-based-migrations/submodule-dependency-configuration/migrations/build.gradle.kts @@ -10,6 +10,6 @@ repositories { } dependencies { - implementation("org.flywaydb:flyway-core:$FLYWAY_VERSION") + compileOnly("org.flywaydb:flyway-core:$FLYWAY_VERSION") implementation("org.apache.commons:commons-lang3:3.12.0") } diff --git a/libs.versions.toml b/libs.versions.toml index 5e445ea..aca460b 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -1,12 +1,13 @@ [versions] jooq = "3.18.7" -flyway = "9.22.3" +flyway = "10.0.0" testcontainers = "1.19.1" jna = "5.13.0" [libraries] jooq-codegen = { module = "org.jooq:jooq-codegen", version.ref = "jooq" } flyway-core = { module = "org.flywaydb:flyway-core", version.ref = "flyway" } +flyway-database-postgres = { module = "org.flywaydb:flyway-database-postgresql", version.ref = "flyway" } jna = { module = "net.java.dev.jna:jna", version.ref = "jna" } testcontainers-jdbc = { module = "org.testcontainers:jdbc", version.ref = "testcontainers" } @@ -21,3 +22,9 @@ gradle-plugin-publish = "com.gradle.publish:plugin-publish-plugin:1.2.1" shadow = "com.github.johnrengelman:shadow:8.1.1" jacoco-testkit = "pl.droidsonroids.gradle.jacoco:pl.droidsonroids.gradle.jacoco:1.0.12" nexus-publish = "io.github.gradle-nexus:publish-plugin:1.3.0" + +[bundles] +flyway = [ + "flyway-core", + "flyway-database-postgres" +] \ No newline at end of file diff --git a/src/test/kotlin/dev/monosoul/jooq/functional/FlywayVersionConfigurationJooqDockerPluginFunctionalTest.kt b/src/test/kotlin/dev/monosoul/jooq/functional/FlywayVersionConfigurationJooqDockerPluginFunctionalTest.kt index 75d7677..55cad06 100644 --- a/src/test/kotlin/dev/monosoul/jooq/functional/FlywayVersionConfigurationJooqDockerPluginFunctionalTest.kt +++ b/src/test/kotlin/dev/monosoul/jooq/functional/FlywayVersionConfigurationJooqDockerPluginFunctionalTest.kt @@ -28,6 +28,7 @@ class FlywayVersionConfigurationJooqDockerPluginFunctionalTest : JooqDockerPlugi dependencies { jooqCodegen("org.flywaydb:flyway-core:${'$'}{RecommendedVersions.FLYWAY_VERSION}") + jooqCodegen("org.flywaydb:flyway-database-postgresql:${'$'}{RecommendedVersions.FLYWAY_VERSION}") jooqCodegen("org.postgresql:postgresql:42.3.6") } """.trimIndent() @@ -47,7 +48,7 @@ class FlywayVersionConfigurationJooqDockerPluginFunctionalTest : JooqDockerPlugi } @ParameterizedTest - @ValueSource(strings = ["8.5.12", "8.4.4", "8.0.5", "7.15.0"]) + @ValueSource(strings = ["9.22.3", "8.5.12", "8.4.4", "8.0.5", "7.15.0"]) fun `should be possible to specify Flyway version to use`(flywayVersion: String) { // given prepareBuildGradleFile { diff --git a/src/test/kotlin/dev/monosoul/jooq/functional/JavaBasedMigrationsFunctionalTest.kt b/src/test/kotlin/dev/monosoul/jooq/functional/JavaBasedMigrationsFunctionalTest.kt index b00fd8d..a5437a8 100644 --- a/src/test/kotlin/dev/monosoul/jooq/functional/JavaBasedMigrationsFunctionalTest.kt +++ b/src/test/kotlin/dev/monosoul/jooq/functional/JavaBasedMigrationsFunctionalTest.kt @@ -122,7 +122,7 @@ class JavaBasedMigrationsFunctionalTest : JooqDockerPluginFunctionalTestBase() { } dependencies { - implementation("org.flywaydb:flyway-core:${'$'}FLYWAY_VERSION") + compileOnly("org.flywaydb:flyway-core:${'$'}FLYWAY_VERSION") } """.trimIndent() } diff --git a/src/test/kotlin/dev/monosoul/jooq/functional/MultipleDatabasesJooqDockerPluginFunctionalTest.kt b/src/test/kotlin/dev/monosoul/jooq/functional/MultipleDatabasesJooqDockerPluginFunctionalTest.kt index b92267e..86b67a5 100644 --- a/src/test/kotlin/dev/monosoul/jooq/functional/MultipleDatabasesJooqDockerPluginFunctionalTest.kt +++ b/src/test/kotlin/dev/monosoul/jooq/functional/MultipleDatabasesJooqDockerPluginFunctionalTest.kt @@ -68,6 +68,7 @@ class MultipleDatabasesJooqDockerPluginFunctionalTest : JooqDockerPluginFunction jooqCodegen("org.postgresql:postgresql:42.3.6") jooqCodegen("mysql:mysql-connector-java:8.0.29") jooqCodegen("org.flywaydb:flyway-mysql:${'$'}{RecommendedVersions.FLYWAY_VERSION}") + jooqCodegen("org.flywaydb:flyway-database-postgresql:${'$'}{RecommendedVersions.FLYWAY_VERSION}") implementation("org.jooq:jooq:${'$'}{RecommendedVersions.JOOQ_VERSION}") } """.trimIndent() diff --git a/src/test/kotlin/dev/monosoul/jooq/functional/NoMigrationsFunctionalTest.kt b/src/test/kotlin/dev/monosoul/jooq/functional/NoMigrationsFunctionalTest.kt index 01e837f..814341d 100644 --- a/src/test/kotlin/dev/monosoul/jooq/functional/NoMigrationsFunctionalTest.kt +++ b/src/test/kotlin/dev/monosoul/jooq/functional/NoMigrationsFunctionalTest.kt @@ -52,6 +52,7 @@ class NoMigrationsFunctionalTest : JooqDockerPluginFunctionalTestBase() { dependencies { jooqCodegen("org.flywaydb:flyway-core:${'$'}FLYWAY_VERSION") + jooqCodegen("org.flywaydb:flyway-database-postgresql:${'$'}FLYWAY_VERSION") jooqCodegen("org.postgresql:postgresql:42.3.6") } """.trimIndent()