gradlejooqgradle-kotlin-dsljooq-codegen

jooq-codegen-gradle plugin: java.lang.ClassNotFoundException: Your configured database type was not found: org.jooq.meta.extensions.ddl.DDLDatabase


I'm trying to use the jooq-codegen-gradle plugin to generate jooq code by reversing engineering sql files (Flyway migrations files). This is how my build.gradle.kts file (only relevant parts) looks like:

...
plugins {
    kotlin("jvm")
    application
    id("org.springframework.boot") version "3.3.0"
    id("org.jooq.jooq-codegen-gradle")
}

...

jooq {
    configuration {
        // Code generation from SQL files (https://www.jooq.org/doc/latest/manual/code-generation/codegen-ddl/)
        generator {
            database {
                name = "org.jooq.meta.extensions.ddl.DDLDatabase"
                properties {
                    property {
                        key = "scripts"
                        value = "src/main/resources/db/migrations/*.sql"
                    }

                    property {
                        key = "sort"
                        value = "flyway"
                    }
                }
            }
        }
    }
}

...

tasks.compileTestKotlin {
    dependsOn += tasks.jooqCodegen
}

...

apply(plugin = "io.spring.dependency-management")
val jooqVersion = the<io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension>().managedVersions["org.jooq:jooq"]!!

dependencies {
    ...
    // Database
    implementation("org.springframework.boot:spring-boot-starter-jooq")
    implementation("org.jooq:jooq-meta-extensions:$jooqVersion")
    implementation("org.postgresql:postgresql")
    implementation("org.flywaydb:flyway-core")
    implementation("org.flywaydb:flyway-database-postgresql")

    ...
}

however ./gradlew build --console=plain fails with:

Execution failed for task ':app:jooqCodegen'.
> java.lang.ClassNotFoundException: Your configured database type was not found: org.jooq.meta.extensions.ddl.DDLDatabase. This can have several reasons:
  - You want to use a commercial jOOQ Edition, but you pulled the Open Source Edition from Maven Central.
  - You have mis-typed your class name.

DDLDatabase is clearly on the classpath:enter image description here

Therefore the error is not very useful and it is not clear to me what I'm missing...


Solution

  • jooqCodegen("org.jooq:jooq-meta-extensions:$jooqVersion")
    

    should be used instead of

    implementation("org.jooq:jooq-meta-extensions:$jooqVersion")