jooq-codegen-gradle插件:java.lang.ClassNotFoundException:找不到您配置的数据库类型:org.jooq.meta.extensions.ddl.DDLDatabase

问题描述 投票:0回答:1

我正在尝试使用

jooq-codegen-gradle
插件通过逆向工程sql文件(Flyway迁移文件)来生成jooq代码。这就是我的
build.gradle.kts
文件(仅相关部分)的样子:

...
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")

    ...
}

但是

./gradlew build --console=plain
失败了:

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
显然在类路径上:enter image description here

因此,该错误不是很有用,而且我不清楚我错过了什么......

gradle jooq gradle-kotlin-dsl jooq-codegen
1个回答
0
投票
jooqCodegen("org.jooq:jooq-meta-extensions:$jooqVersion")
应该使用

代替

implementation("org.jooq:jooq-meta-extensions:$jooqVersion")
© www.soinside.com 2019 - 2024. All rights reserved.