Marlon Ou
Marlon Ou

Reputation: 501

jOOQ generated code cannot be compiled?

I have used this tool: https://github.com/etiennestuder/gradle-jooq-plugin from jOOQ's official website to generate code from my database.

Yet if I set

directory = 'src/main/java'

when I run "gradle build", I get all these compile errors like:

database/information_schema/InformationSchema.java:218: error: no suitable constructor found for SchemaImpl(String,<null>)
        super("INFORMATION_SCHEMA", null);
        ^
    constructor SchemaImpl.SchemaImpl(Name) is not applicable
      (actual and formal argument lists differ in length)
    constructor SchemaImpl.SchemaImpl(String) is not applicable
      (actual and formal argument lists differ in length)

Any fix for this?

Note that I wanted to put the generated code into the src folder because I want to use them in my code. I've heard to put them in the target or build folder instead, but I'm not sure how do you access those classes from target or build folder?

Thanks!

Upvotes: 1

Views: 538

Answers (2)

Lukas Eder
Lukas Eder

Reputation: 220867

I've written a short blog post about this. Starting with jOOQ 3.16 and #12601, there's an additional compilation error in case users use:

  • An older version of org.jooq:jooq (the runtime library)
  • A newer version of org.jooq:jooq-codegen (the code generation library)

In general, the runtime library version >= codegen library version. The new compilation error might look like this:

[ERROR] …/DefaultCatalog.java:[53,73] cannot find symbol
[ERROR] symbol: variable VERSION_3_17
[ERROR] location: class org.jooq.Constants

Please note that while unrelated to your question, there's now an official jooq-codegen-gradle plugin.

Upvotes: 0

Marlon Ou
Marlon Ou

Reputation: 501

I was on 3.7. Now I switch to 3.9, everything turns out to be fine...

Upvotes: 0

Related Questions