I’ve started a new project and wanted to use jOOQ,...
# getting-started
a
I’ve started a new project and wanted to use jOOQ, everything kind of worked until I wanted to add autogenerated classes. I’m getting such weird errors and I can’t for the life of dog me figure out what I’m doing wrong. I’m using the latest versions of packages, their builds seem to pass and the docs also state that everything should work together nicely but it doesn’t. And the errors are so… seemingly simple that Claude is also no help. 🥲 Anybody have experience with jOOQ code gen with a gradle plugin?
k
maybe post the errors and it may trigger something
a
Of course. Here's the error:
k
I would check version compatibility
a
I did. nu.studer.jooq, according to their version matrix, works with my gradle version (8.6+) and with my jOOQ version (3.20+)
The builds pass, my configs are completely default
k
dependency:tree shows only one version of jooq?
a
Sorry gradle/IntelliJ killed my Win11 completely. I hate working on windows.
One sec, gotta restart…
Okay now my Gradle is dead. Why did I decide to use Kotlin for this...
huh this is odd
Copy code
jooqGenerator - The classpath used to invoke the jOOQ code generator. Add your JDBC driver, generator extensions, and additional dependencies here.
+--- org.jooq:jooq-codegen:3.20.3
|    +--- org.jooq:jooq:3.20.3 -> 3.19.21
|    |    \--- io.r2dbc:r2dbc-spi:1.0.0.RELEASE
|    |         \--- org.reactivestreams:reactive-streams:1.0.3 -> 1.0.4
|    \--- org.jooq:jooq-meta:3.20.3 -> 3.19.21
|         +--- org.jooq:jooq:3.19.21 (*)
|         \--- jakarta.xml.bind:jakarta.xml.bind-api:4.0.0 -> 4.0.2
|              \--- jakarta.activation:jakarta.activation-api:2.1.3
\--- org.postgresql:postgresql:42.7.2
     \--- org.checkerframework:checker-qual:3.42.0
jooq meta uses a different minor version
Also jooqGenerator seems to have a very small denepdencny tree
e
Hi, this is the project I scaffolded 2 weeks ago. It uses Java, but maybe a few tricks would make it use Kotlin as well. Maybe would be helpful https://github.com/Sedose/playground-jooq at least config in
build.gradle.kts
and general things. E.g. you can start with booting this project up and incrementally get rid of Java for Kotlin
a
Thanks, Edgar! I’ll give it a try! Seems pretty much exactly what I need :) The Java part is not an issue, I think transforming it into kotlin is fairly simple
Weirdly everything looks quite similar, but maybe it’s the small differences that create the most pain. I’ll give it a try a bit later and will report back. Much appreciated!
💛 1
I think I figured it out. I had to basically define dependencies for
jooqGenerator
as well as the implementation dependencies.
Copy code
implementation("org.jooq:jooq:$jooqVersion")
    implementation("org.jooq:jooq-kotlin:$jooqVersion")
    implementation("org.jooq:jooq-meta:$jooqVersion")
    implementation("org.jooq:jooq-meta-kotlin:$jooqVersion")
    implementation("org.jooq:jooq-codegen:$jooqVersion")
    implementation("org.postgresql:postgresql:42.7.5")

    // JOOQ Generator
    jooqGenerator("org.postgresql:postgresql:42.7.5")
    jooqGenerator("org.jooq:jooq-meta:$jooqVersion")
    jooqGenerator("org.jooq:jooq-meta-kotlin:$jooqVersion")
    jooqGenerator("org.jooq:jooq-codegen:$jooqVersion")
    jooqGenerator("org.jooq:jooq:$jooqVersion")
    jooqGenerator("org.jooq:jooq-kotlin:$jooqVersion")
After that everything worked. But it feels wrong somehow. Feels like a crutch.