jooqjooq-codegen-maven

Forcing jOOQ codegen to run despite matching schema version


My new user types were not getting added to the generated model and it took me a good half an hour to understand why.

Steps to reproduce the issue:

I've been hoisted by my own petard: I set up jOOQ not to run codegen if nothing was added to the Flyway migrations, then I added stuff that it should know about during codegen, but didn't touch the Flyway migrations.

I can munge my schemaVersionProvider query manually in pom.xml, forcing the version not to match anymore, and the full codegen to run. Is there a better way? I'm using Maven, so is there an existing jooq-codegen:generate property that I can use to ignore schema version matching, maybe?

Failing that, I can probably replace schemaVersionProvider with a property that is by default set to the SELECT query I'm currently using; then I could do mvn jooq-codegen:generate -Dmy.schemaVersionProvider=$(uuidgen), but I'm hoping for something built-in. I was not able to find the documentation for jooq-codegen-maven online.


Solution

  • This is an interesting issue that wouldn't happen with the Gradle plugin, for example, which takes all the plugin input into consideration to decide whether the plugin needs to be run again or not. The plugin configuration is part of this input. It would obviously be useful for jOOQ's Maven plugin as well as the standalone code generation utility to emulate this Gradle behaviour:

    Even more simply, it should be possible to set a system property or similar to force re-generation:

    As a workaround, for one-shot enforcement of re-generation, you could manually: