The gradle-jooq-plugin provides a convenient way to perform SQL code generation in your builds. Unfortunately, this plugin automatically creates a dependency between the code generation task and the build task, as seen here. This is undesirable because it requires you to have access to your jOOQ source database from every build environment, which may not be feasible.
To remove this dependency, we first need to get the name of the jOOQ task that this plugin automatically creates for us. According to the documentation:
a jOOQ configuration named sample will cause the plugin to add a new code generation task generateSampleJooqSchemaSource to the project.
The following command will display all of the tasks in your gradle file. You can pull the name of your jOOQ code generation task from the output of this command:
Once you have the name of the jOOQ task, you can disable it by default by adding this to your
Be sure to change
generateSampleJooqSchemaSource in the example above to the name of your jOOQ task. Now, you can run
gradle build from an environment without access to your jOOQ source database. Also, if you would like to run the code generation task, just run it separately like you would with any other task. For example: