Gradle plugin that help with integration of jOOQ and Flyway plugins, improving Gradle uptodate check on jOOQ task by adding check of currently applied Flyway scripts. For each jOOQ task, the plugin adds dependency to Flyway by checking wheather database schema has changed or not since last code generation. If you rely on Flyway to manage database changes and using jOOQ same time - this plugin will ensure that jOOQ will regenerate your classes every time you changed the database with Flyway.
The flywayJooq plugin relies on two great plugins: flyway-gradle-plugin by boxfuse and gradle-jooq-plugin by Etienne Studer. When both of them are applied flywayJooq adds an extra dependency to the jOOQ task that checks if there are any differences in applied scripts.
The plugin is hosted at Bintray's JCenter.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'pl.codelabs:gradle-flyway-jooq-plugin:1.3.1'
}
}
apply plugin: 'pl.codelabs.flywayJooq'
plugins {
id 'pl.codelabs.flywayJooq' version '1.3.1'
}
For each jOOQ configuration declared in the build, the plugin adds dependency to :flywayJooqInfoFile task that dumps out list of applied scripts into a file. the format of the file is identical to flywayInfo (as it's generated by Flyway utils) with the difference only scripts applied to database are there.
>gradle generateSampleJooqSchemaSource
:flywayJooqInfoFile
Dumping flyway info to build\tmp\flywayJooqInfoFile\flywayJooq.info
:generateSampleJooqSchemaSource UP-TO-DATE
BUILD SUCCESSFUL
>gradle flywayMigrate
:flywayJooqInfoFile
Dumping flyway info to build\tmp\flywayJooqInfoFile\flywayJooq.info
:generateSampleJooqSchemaSource UP-TO-DATE
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:flywayMigrate
BUILD SUCCESSFUL
>gradle generateSampleJooqSchemaSource
:flywayJooqInfoFile
Dumping flyway info to build\tmp\flywayJooqInfoFile\flywayJooq.info
:generateSampleJooqSchemaSource
BUILD SUCCESSFUL
The plugin doesn't need any configuration.
This plugin is available under the Apache License, Version 2.0.
(c) by Wojciech Strzalka