可用版本:Dev (3.21) | 最新 (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

使用 Gradle 运行代码生成器

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

从 jOOQ 3.19 开始,jOOQ 的代码生成器提供了开箱即用的 gradle 支持,以下对此进行了说明。

使用 Gradle 运行代码生成器或在独立模式下运行代码生成器之间没有实质性区别。两种模式都使用完全相同的 <configuration/> 元素。 Gradle 插件配置在它周围添加了一些额外的样板代码

Kotlin
Groovy
plugins {

             // Use org.jooq                for the Open Source Edition
             //     org.jooq.pro            for commercial editions with Java 21 support,
             //     org.jooq.pro-java-17    for commercial editions with Java 17 support,
             //     org.jooq.pro-java-11    for commercial editions with Java 11 support,
             //     org.jooq.pro-java-8     for commercial editions with Java 8 support,
             //     org.jooq.trial          for the free trial edition with Java 21 support,
             //     org.jooq.trial-java-17  for the free trial edition with Java 17 support,
             //     org.jooq.trial-java-11  for the free trial edition with Java 11 support,
             //     org.jooq.trial-java-8   for the free trial edition with Java 8 support
             //
             // Note: Only the Open Source Edition is hosted on Maven Central.
             //       Install the others locally using the provided scripts, or access them from here: https://repo.jooq.org
             //       See the JDK version support matrix here: https://jooq.org.cn/download/support-matrix-jdk

    id("org.jooq.jooq-codegen-gradle") version "3.20.5"
}

dependencies {

    // Code generation specific dependencies, like JDBC drivers, codegen extensions, etc.
    jooqCodegen("...")
}

jooq {
    configuration {
        // ...
    }
}

有关更多详细信息,请参阅配置 XSD或手册中有关代码生成的各个部分。

plugins {

             // Use org.jooq                for the Open Source Edition
             //     org.jooq.pro            for commercial editions with Java 21 support,
             //     org.jooq.pro-java-17    for commercial editions with Java 17 support,
             //     org.jooq.pro-java-11    for commercial editions with Java 11 support,
             //     org.jooq.pro-java-8     for commercial editions with Java 8 support,
             //     org.jooq.trial          for the free trial edition with Java 21 support,
             //     org.jooq.trial-java-17  for the free trial edition with Java 17 support,
             //     org.jooq.trial-java-11  for the free trial edition with Java 11 support,
             //     org.jooq.trial-java-8   for the free trial edition with Java 8 support
             //
             // Note: Only the Open Source Edition is hosted on Maven Central.
             //       Install the others locally using the provided scripts, or access them from here: https://repo.jooq.org
             //       See the JDK version support matrix here: https://jooq.org.cn/download/support-matrix-jdk

    id "org.jooq.jooq-codegen-gradle" version "3.20.5"
}

dependencies {

    // Code generation specific dependencies, like JDBC drivers, codegen extensions, etc.
    jooqCodegen "..."
}

jooq {
    configuration {
        // ...
    }
}

有关更多详细信息,请参阅配置 XSD或手册中有关代码生成的各个部分。

使用以上配置,隐式地进行单次执行。

反馈

您对此页面有任何反馈吗? 我们很乐意听取您的意见!

The jOOQ Logo