Thanks for sharing, Adam. That's a very interesting approach, so the generation is always "all or nothing" and it won't allow for incremental builds, right?
If incremental builds are desired (e.g. a database change involves only 1-2 columns that need regeneration), then, perhaps the catalog / schema version provider SPI could be useful, instead: https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-version-providers This works very well with Flyway, where the schema version provider can look up the schema version in the Flyway migration table and prevent a re-generation if the version hasn't changed. Hope this helps, Lukas 2017-05-06 20:29 GMT+02:00 Adam Gent <[email protected]>: > Hi all, > > A tip for those using Maven that use the code generation plugin is to put > the plugin in its own profile and have it only activate > when the generated-sources directory is missing. > > <profile> > <id>jooq</id> > <activation> > <!-- trick to disable constant jooq generation --> > <file> > <missing>${basedir}/target/generated-sources</missing> > </file> > </activation> > <build> > <plugins> > <!-- flyway plugin --> > <!-- jooq plugin --> > </plugins> > </build> > </profile> > > Now I realize not everyone generates the classes on every build and might > prefer checking in the classes but we like to generate the classes after > running the flyway migration scripts. > > The only caveat now is that developers must run a "mvn clean" if they want > to rerun the code generation which typically happens anyway when a > developer pulls. It also will always happen on the build machine since the > build machine starts from scratch anyway. > > The way we roughly structure our maven projects is to alway have a > multimodule project. Then we make a jooq module that only has the flyway > plugin and migration scripts and the jooq code generator plugin. No other > code. Then other modules depend on the jooq module. This works pretty well. > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
