|
| 1 | +--- |
| 2 | +title: Gradle plugin |
| 3 | +sidebar_position: 25 |
| 4 | +--- |
| 5 | + |
| 6 | +# Gradle plugin |
| 7 | + |
| 8 | +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. |
| 9 | + |
| 10 | +## Why use the plugin? |
| 11 | + |
| 12 | +Setting up Flamingock manually requires adding several dependencies: |
| 13 | + |
| 14 | +```kotlin |
| 15 | +// Without the plugin - multiple dependencies to manage |
| 16 | +implementation(platform("io.flamingock:flamingock-community-bom:$version")) |
| 17 | +implementation("io.flamingock:flamingock-community") |
| 18 | +implementation("io.flamingock:flamingock-springboot-integration") |
| 19 | +testImplementation("io.flamingock:flamingock-springboot-test-support") |
| 20 | +annotationProcessor("io.flamingock:flamingock-processor:$version") |
| 21 | +``` |
| 22 | + |
| 23 | +With the plugin, this becomes: |
| 24 | + |
| 25 | +```kotlin |
| 26 | +// With the plugin - simple DSL |
| 27 | +plugins { |
| 28 | + id("io.flamingock") version "$version" |
| 29 | +} |
| 30 | + |
| 31 | +flamingock { |
| 32 | + community() |
| 33 | + springboot() |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +The plugin automatically adds the correct dependencies, annotation processors, and BOMs based on your configuration. |
| 38 | + |
| 39 | + |
| 40 | +## Requirements |
| 41 | + |
| 42 | +- **Gradle** 7.4+ |
| 43 | +- **Java** 8+ |
| 44 | + |
| 45 | + |
| 46 | +## Quick start |
| 47 | + |
| 48 | +Add the plugin to your `build.gradle.kts`: |
| 49 | + |
| 50 | +```kotlin |
| 51 | +plugins { |
| 52 | + id("io.flamingock") version "$version" |
| 53 | +} |
| 54 | + |
| 55 | +flamingock { |
| 56 | + community() |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +Or in `build.gradle` (Groovy): |
| 61 | + |
| 62 | +```groovy |
| 63 | +plugins { |
| 64 | + id 'io.flamingock' version '$version' |
| 65 | +} |
| 66 | +
|
| 67 | +flamingock { |
| 68 | + community() |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | + |
| 73 | +## Configuration options |
| 74 | + |
| 75 | +| Method | Description | |
| 76 | +|--------|-------------| |
| 77 | +| `community()` | Enables Community edition (adds BOM and core library) | |
| 78 | +| `springboot()` | Adds Spring Boot integration and test support | |
| 79 | +| `graalvm()` | Adds GraalVM native image support | |
| 80 | +| `mongock()` | Enables seamless migration from Mongock — imports audit log, detects legacy change units, and executes pending ones | |
| 81 | + |
| 82 | + |
| 83 | +## What gets added |
| 84 | + |
| 85 | +The plugin automatically adds dependencies based on your configuration: |
| 86 | + |
| 87 | +### Always added |
| 88 | + |
| 89 | +```kotlin |
| 90 | +annotationProcessor("io.flamingock:flamingock-processor:$version") |
| 91 | +``` |
| 92 | + |
| 93 | +### community() |
| 94 | + |
| 95 | +```kotlin |
| 96 | +implementation(platform("io.flamingock:flamingock-community-bom:$version")) |
| 97 | +implementation("io.flamingock:flamingock-community") |
| 98 | +``` |
| 99 | + |
| 100 | +### springboot() |
| 101 | + |
| 102 | +```kotlin |
| 103 | +implementation("io.flamingock:flamingock-springboot-integration") |
| 104 | +testImplementation("io.flamingock:flamingock-springboot-test-support") |
| 105 | +``` |
| 106 | + |
| 107 | +### graalvm() |
| 108 | + |
| 109 | +```kotlin |
| 110 | +implementation("io.flamingock:flamingock-graalvm") |
| 111 | +``` |
| 112 | + |
| 113 | +### mongock() |
| 114 | + |
| 115 | +```kotlin |
| 116 | +implementation("io.flamingock:mongock-support") |
| 117 | +annotationProcessor("io.flamingock:mongock-support") |
| 118 | +``` |
| 119 | + |
| 120 | + |
| 121 | +## Examples |
| 122 | + |
| 123 | +### Basic standalone application |
| 124 | + |
| 125 | +```kotlin |
| 126 | +plugins { |
| 127 | + java |
| 128 | + id("io.flamingock") version "$version" |
| 129 | +} |
| 130 | + |
| 131 | +flamingock { |
| 132 | + community() |
| 133 | +} |
| 134 | + |
| 135 | +dependencies { |
| 136 | + // Your audit store |
| 137 | + implementation("io.flamingock:flamingock-auditstore-mongodb-sync") |
| 138 | + |
| 139 | + // Your drivers |
| 140 | + implementation("org.mongodb:mongodb-driver-sync:5.0.0") |
| 141 | +} |
| 142 | +``` |
| 143 | + |
| 144 | +### Spring Boot application |
| 145 | + |
| 146 | +```kotlin |
| 147 | +plugins { |
| 148 | + java |
| 149 | + id("org.springframework.boot") version "3.2.0" |
| 150 | + id("io.spring.dependency-management") version "1.1.4" |
| 151 | + id("io.flamingock") version "$version" |
| 152 | +} |
| 153 | + |
| 154 | +flamingock { |
| 155 | + community() |
| 156 | + springboot() |
| 157 | +} |
| 158 | + |
| 159 | +dependencies { |
| 160 | + // Your audit store |
| 161 | + implementation("io.flamingock:flamingock-auditstore-mongodb-sync") |
| 162 | + |
| 163 | + // Your drivers |
| 164 | + implementation("org.mongodb:mongodb-driver-sync:5.0.0") |
| 165 | +} |
| 166 | +``` |
| 167 | + |
| 168 | +### Migrating from Mongock |
| 169 | + |
| 170 | +```kotlin |
| 171 | +plugins { |
| 172 | + java |
| 173 | + id("io.flamingock") version "$version" |
| 174 | +} |
| 175 | + |
| 176 | +flamingock { |
| 177 | + community() |
| 178 | + springboot() |
| 179 | + mongock() // Adds Mongock migration support |
| 180 | +} |
| 181 | +``` |
| 182 | + |
| 183 | +### With GraalVM native image |
| 184 | + |
| 185 | +```kotlin |
| 186 | +plugins { |
| 187 | + java |
| 188 | + id("org.graalvm.buildtools.native") version "0.9.28" |
| 189 | + id("io.flamingock") version "$version" |
| 190 | +} |
| 191 | + |
| 192 | +flamingock { |
| 193 | + community() |
| 194 | + graalvm() // Adds GraalVM support |
| 195 | +} |
| 196 | +``` |
| 197 | + |
| 198 | + |
| 199 | +## Alternative: Manual dependencies |
| 200 | + |
| 201 | +If you prefer to manage dependencies manually, or if you're using Maven, see the dependency sections in each feature's documentation: |
| 202 | + |
| 203 | +- [Quick start](./quick-start.md) - Core Flamingock dependencies |
| 204 | +- [Spring Boot integration](../frameworks/springboot-integration/introduction.md) - Spring Boot dependencies |
| 205 | +- [Coming from Mongock](../resources/coming-from-mongock.md) - Mongock migration dependencies |
| 206 | + |
| 207 | + |
| 208 | +## Links |
| 209 | + |
| 210 | +- [Gradle Plugin Portal](https://plugins.gradle.org/plugin/io.flamingock) |
| 211 | +- [Plugin source code](https://github.com/flamingock/flamingock-gradle-plugin) |
0 commit comments