Skip to content

wstrzalka/gradle-flyway-jooq-plugin

Repository files navigation

gradle-jooq-flyway-plugin

Overview

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.

Plugin

General

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.

Gradle 1.x and 2.0

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'pl.codelabs:gradle-flyway-jooq-plugin:1.3.1'
    }
}
apply plugin: 'pl.codelabs.flywayJooq'

Gradle 2.1 and higher

plugins {
  id 'pl.codelabs.flywayJooq' version '1.3.1'
}

Tasks

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

Configuration

The plugin doesn't need any configuration.

License

This plugin is available under the Apache License, Version 2.0.

(c) by Wojciech Strzalka

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages