Skip to main content

Gradle plugin

The Flamingock Gradle Plugin provides zero-boilerplate dependency configuration for your Gradle projects. Instead of manually managing multiple dependencies, you configure Flamingock with a simple DSL.

Why use the plugin?

Setting up Flamingock manually requires adding several dependencies:

// Without the plugin - multiple dependencies to manage
implementation(platform("io.flamingock:flamingock-bom:$version"))
implementation("io.flamingock:flamingock-community")
implementation("io.flamingock:flamingock-springboot-integration")
testImplementation("io.flamingock:flamingock-springboot-test-support")
annotationProcessor("io.flamingock:flamingock-processor:$version")

With the plugin, this becomes:

// With the plugin - simple DSL
plugins {
id("io.flamingock") version "[VERSION]"
}

flamingock {
community()
springboot()
}

The plugin automatically adds the correct dependencies, annotation processors, and BOMs based on your configuration.

Build integration

One-time clean build on upgrade

If you are upgrading to Flamingock 1.3.0 or later from a previous version, or migrating from Mongock to Flamingock 1.3.0+, run a clean build once after the upgrade:

  • Gradle: ./gradlew clean build
  • Maven: mvn clean install

This regenerates Flamingock's per-module metadata in the new incremental format. Without a clean build, the build system may skip recompiling already-compiled change classes, and the resulting metadata file will omit them — potentially causing changes to be missing at runtime. Subsequent builds are incremental as normal.

  • Template files (*.yaml, *.yml) under src/main/resources and src/main/java are registered as compile-task inputs, so changes are picked up by Gradle's up-to-date check and reflected in the IDE on the next sync.
  • The Flamingock annotation processor is registered as an aggregating incremental processor; subsequent builds reprocess only what changed.

Requirements

  • Gradle 7.4+
  • Java 8+

Quick start

Add the plugin to your build.gradle.kts:

plugins {
id("io.flamingock") version "[VERSION]"
}

flamingock {
community()
}

Configuration options

MethodDescription
community()Enables Community edition (adds BOM and core library)
sql()Adds SQL template and target system support
mongodb()Adds MongoDB sync template and target system support
dynamodb()Adds DynamoDB target system support
couchbase()Adds Couchbase target system support
springboot()Adds Spring Boot integration and test support
graalvm()Adds GraalVM native image support
mongock()Enables seamless migration from Mongock — imports audit log, detects legacy change units, and executes pending ones

Kotlin support Since 1.4.2

Kotlin (JVM) projects are supported automatically. When the plugin detects org.jetbrains.kotlin.jvm, it applies org.jetbrains.kotlin.kapt and registers flamingock-processor under the kapt configuration so the annotation processor runs against your Kotlin sources. No additional setup is required:

plugins {
kotlin("jvm") version "..."
id("io.flamingock") version "..."
}

flamingock {
community()
springboot()
}

Opting out of the kapt auto-apply Since 1.4.2

Set the Gradle property flamingock.autoApplyKapt=false if you want to manage kapt yourself (or are migrating to KSP, which the plugin will support in a future release). Recognised settings:

# gradle.properties
flamingock.autoApplyKapt=false

or on the command line:

./gradlew build -Pflamingock.autoApplyKapt=false
Why a Gradle property and not a flamingock { … } setting

The plugins { } block evaluates before the flamingock { } block in build.gradle.kts. The auto-apply has to make its decision the moment kotlin.jvm is applied — well before any DSL setter would run. A Gradle property is the only mechanism available at that point. When you opt out, you are responsible for wiring kotlin.kapt (or your annotation-processor of choice) yourself; the plugin will still register flamingock-processor under the kapt configuration if one exists.

What gets added

The plugin automatically adds dependencies based on your configuration:

Always added

annotationProcessor("io.flamingock:flamingock-processor:$version")

community()

implementation(platform("io.flamingock:flamingock-bom:$version"))
implementation("io.flamingock:flamingock-community")
testImplementation("io.flamingock:flamingock-test-support")

sql()

implementation("io.flamingock:flamingock-sql-template")
implementation("io.flamingock:flamingock-sql-targetsystem")

mongodb()

implementation("io.flamingock:flamingock-mongodb-sync-template")
implementation("io.flamingock:flamingock-mongodb-sync-targetsystem")

When springboot() is also enabled:

implementation("io.flamingock:flamingock-mongodb-springdata-targetsystem")

dynamodb()

implementation("io.flamingock:flamingock-dynamodb-targetsystem")

couchbase()

implementation("io.flamingock:flamingock-couchbase-targetsystem")

springboot()

implementation("io.flamingock:flamingock-springboot-integration")
testImplementation("io.flamingock:flamingock-springboot-test-support")

graalvm()

implementation("io.flamingock:flamingock-graalvm")

mongock()

implementation("io.flamingock:mongock-support")
annotationProcessor("io.flamingock:mongock-support")

Examples

Basic standalone application

plugins {
java
id("io.flamingock") version "[VERSION]"
}

flamingock {
community()
}

dependencies {
// Your audit store
implementation("io.flamingock:flamingock-auditstore-mongodb-sync")

// Your drivers
implementation("org.mongodb:mongodb-driver-sync:5.0.0")
}

Spring Boot application

plugins {
java
id("org.springframework.boot") version "3.2.0"
id("io.spring.dependency-management") version "1.1.4"
id("io.flamingock") version "[VERSION]"
}

flamingock {
community()
springboot()
}

dependencies {
// Your audit store
implementation("io.flamingock:flamingock-auditstore-mongodb-sync")

// Your drivers
implementation("org.mongodb:mongodb-driver-sync:5.0.0")
}

Migrating from Mongock

plugins {
java
id("io.flamingock") version "[VERSION]"
}

flamingock {
community()
springboot()
mongock() // Adds Mongock migration support
}

With GraalVM native image

plugins {
java
id("org.graalvm.buildtools.native") version "0.9.28"
id("io.flamingock") version "[VERSION]"
}

flamingock {
community()
graalvm() // Adds GraalVM support
}

Alternative: Manual dependencies

If you prefer to manage dependencies manually, or if you're using Maven, see the dependency sections in each feature's documentation: