{"id":23788719,"url":"https://github.com/suppierk/jooq-java-class-generator","last_synced_at":"2026-05-10T23:14:52.273Z","repository":{"id":258016635,"uuid":"861209794","full_name":"SuppieRK/jooq-java-class-generator","owner":"SuppieRK","description":"Generates jOOQ Java classes from the database launched in Docker container after Flyway migrations were applied","archived":false,"fork":false,"pushed_at":"2025-02-20T20:47:25.000Z","size":122,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-20T21:32:07.502Z","etag":null,"topics":["database","docker","flyway","generator","jooq"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SuppieRK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-22T09:54:46.000Z","updated_at":"2025-02-20T20:44:15.000Z","dependencies_parsed_at":"2024-12-12T02:36:53.938Z","dependency_job_id":"d5edec58-1ade-4a05-bc23-162085121686","html_url":"https://github.com/SuppieRK/jooq-java-class-generator","commit_stats":null,"previous_names":["suppierk/jooq-java-class-generator"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuppieRK%2Fjooq-java-class-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuppieRK%2Fjooq-java-class-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuppieRK%2Fjooq-java-class-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuppieRK%2Fjooq-java-class-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SuppieRK","download_url":"https://codeload.github.com/SuppieRK/jooq-java-class-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240012445,"owners_count":19733904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","docker","flyway","generator","jooq"],"created_at":"2025-01-01T16:48:00.217Z","updated_at":"2026-05-10T23:14:52.264Z","avatar_url":"https://github.com/SuppieRK.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jOOQ Java Class Generator\n\n[![Build status](https://github.com/SuppieRK/jooq-java-class-generator/actions/workflows/build.yml/badge.svg)](https://github.com/SuppieRK/jooq-java-class-generator/actions/workflows/build.yml)\n[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/io.github.suppierk.jooq-java-class-generator.svg?label=Gradle%20Plugin)](https://plugins.gradle.org/plugin/io.github.suppierk.jooq-java-class-generator)\n[![Latest release](https://img.shields.io/github/v/release/SuppieRK/jooq-java-class-generator.svg?display_name=tag)](https://github.com/SuppieRK/jooq-java-class-generator/releases)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSuppieRK%2Fjooq-java-class-generator.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FSuppieRK%2Fjooq-java-class-generator?ref=badge_shield)\n\n\u003e This project is a personal endeavor and is **not affiliated with my employer**.  \n\u003e I maintain it independently in my **spare time**, using my **personal equipment**.\n\n---\n\n## Why use this plugin?\n\nManually managing ephemeral databases, Flyway migrations, and jOOQ code generation slows down local development and CI\nbuilds.  \n**jOOQ Java Class Generator** automates all of it — spin up containers, run migrations, and generate type-safe SQL\nclasses in a single Gradle task.\n\n---\n\n## Highlights\n\n- Spins up **temporary Testcontainers databases** during the build\n- Runs **Flyway migrations** using the Flyway API\n- Triggers **jOOQ code generation** — all in one step\n- Provides a **dedicated Gradle DSL (`jooqCodegen`)** for configuration\n- Tasks are **cacheable** — Gradle marks them `UP-TO-DATE` when inputs remain unchanged\n- Compatible with both **Groovy and Kotlin DSLs**\n\n---\n\n## Requirements\n\n| Tool       | Minimum version | Notes                                                                                                         |\n|------------|-----------------|---------------------------------------------------------------------------------------------------------------|\n| Java       | 21+             | Required by [gradle-jooq-plugin 10.0](https://github.com/etiennestuder/gradle-jooq-plugin/releases/tag/v10.0) |\n| jOOQ       | 3.20.3+         | Matches [gradle-jooq-plugin 10.1](https://github.com/etiennestuder/gradle-jooq-plugin/releases/tag/v10.1)     |\n| Gradle     | 8.6+            | Same as gradle-jooq 10.0                                                                                      |\n| PostgreSQL | 17+             | As per [jOOQ OSS support matrix](https://www.jooq.org/download/support-matrix#PostgreSQL)                     |\n\n\u003e Note for `spring-boot-starter-jooq` users - please, look which jOOQ dependency is used by this dependency and set the same version in `jooq { version = 'XXX' }`\n\n---\n\n## Installation\n\n### Using plugins DSL\n\n**Groovy DSL**\n\n```groovy\nplugins {\n    id 'io.github.suppierk.jooq-java-class-generator' version '3.1.0'\n}\n```\n\n### Using legacy plugin application\n\n```groovy\nbuildscript {\n    repositories {\n        maven { url 'https://plugins.gradle.org/m2/' }\n    }\n    dependencies {\n        classpath 'io.github.suppierk:plugin:3.1.0'\n    }\n}\n\napply plugin: 'io.github.suppierk.jooq-java-class-generator'\n```\n\n---\n\n## Example Project\n\nSee [`example-project`](./example-project) for:\n\n- Flyway migration for PostgreSQL\n- Groovy DSL usage\n\n---\n\n## Full Configuration DSL\n\nDeclare temporary databases and schemas under the `jooqCodegen` extension. Configure the schema in\nat least one place (`generator.database.inputSchema` via jOOQ or `flyway { defaultSchema = ... }`\nin the DSL) so the plugin knows which schema to migrate and introspect. Setting both keeps Flyway\nand jOOQ in sync.\n\n**Groovy DSL**\n\n```groovy\njooqCodegen {\n    database(\"analyticsDb\") {\n        driver = \"org.postgresql.Driver\" // required\n\n        container {\n            image = \"postgres:17-alpine\" // optional override\n        }\n\n        schema(\"public\") {\n            flyway {\n                locations = \"classpath:db/migration/public\"\n                defaultSchema = \"public\"\n                cleanDisabled = true\n                placeholder \"foo\", \"bar\"\n            }\n            jooqConfigurations = ['pgPublic']\n        }\n\n        schema(\"audit\") {\n            flyway {\n                locations = \"classpath:db/migration/audit\"\n                defaultSchema = \"audit\"\n            }\n            jooqConfigurations = ['pgAudit']\n        }\n    }\n}\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eKotlin DSL\u003c/summary\u003e\n\n```kotlin\njooqCodegen {\n    database(\"analyticsDb\") {\n        driver = \"org.postgresql.Driver\"\n\n        container {\n            image().set(\"postgres:17-alpine\")\n        }\n\n        schemas.create(\"public\") {\n            flyway {\n                locations = listOf(\"classpath:db/migration/public\")\n                defaultSchema = \"public\"\n                cleanDisabled = true\n                placeholders = mapOf(\"foo\" to \"bar\")\n            }\n            jooqConfigurations = listOf(\"pgPublic\")\n        }\n\n        schemas.create(\"audit\") {\n            flyway {\n                locations = listOf(\"classpath:db/migration/audit\")\n                defaultSchema = \"audit\"\n            }\n            jooqConfigurations = listOf(\"pgAudit\")\n        }\n    }\n}\n```\n\n\u003c/details\u003e\n\n---\n\n### Key Properties\n\n| Scope      | Property              | Description                                                                                   |\n|------------|-----------------------|-----------------------------------------------------------------------------------------------|\n| `database` | `driver` *(required)* | JDBC driver class used to determine the Testcontainers implementation                         |\n| `database` | `container.image`     | Optional Docker image override (defaults: PostgreSQL `postgres:17-alpine`, MySQL `mysql:8.4`) |\n| `schema`   | `flyway { ... }`      | Full Flyway configuration for that schema; overrides built-in defaults provided by the plugin |\n| `schema`   | `jooqConfigurations`  | Names of pre-existing jOOQ configurations to execute against the temporary DB                 |\n\n---\n\n### Generated Tasks\n\nEach schema registers its own Gradle task, and an aggregate task coordinates them all.\n\n| Task                                         | Description                          |\n|----------------------------------------------|--------------------------------------|\n| `generate\u003cConfigurationName\u003eDatabaseClasses` | Runs Flyway and jOOQ for that schema |\n| `generateDatabaseClasses`                    | Runs all schema tasks                |\n\nThese tasks depend on `processResources`, run before `compileJava`, and are included in `sourcesJar`.\n\n---\n\n## Caching Behavior\n\nTasks are annotated with `@CacheableTask`. Gradle considers them `UP-TO-DATE` when the following remain unchanged:\n\n- Effective Flyway configuration (schemas, locations, placeholders, etc.)\n- Selected Testcontainers image\n- Normalized jOOQ configuration hash\n- Resolved migration directories\n\nAny DSL or migration change invalidates the cache. This makes the plugin **CI-friendly and highly incremental**.\n\n---\n\n## Integration Notes\n\nThe plugin:\n\n- Applies [`nu.studer.gradle-jooq`](https://github.com/etiennestuder/gradle-jooq-plugin)\n- Reuses Flyway’s configuration model **without** applying the official Flyway Gradle plugin\n\nFor deeper tuning, see:\n\n- [nu.studer gradle-jooq configuration](https://github.com/etiennestuder/gradle-jooq-plugin?tab=readme-ov-file#configuration)\n\n---\n\n## Troubleshooting\n\n- Ensure your `jooqConfigurations` match the names declared under `jooq.configurations`.\n- You can inspect Flyway configurations with `--info`.\n- To debug migrations or container startup, run Gradle with `--stacktrace --debug`.\n\n---\n\n## License\n\nLicensed under [MIT License](./LICENSE).  \nDependency licenses managed\nvia [FOSSA](https://app.fossa.com/projects/git%2Bgithub.com%2FSuppieRK%2Fjooq-java-class-generator?ref=badge_shield).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuppierk%2Fjooq-java-class-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuppierk%2Fjooq-java-class-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuppierk%2Fjooq-java-class-generator/lists"}