From cf11c2c5aeef2c3fdf6cc0522820f70639ab5f7f Mon Sep 17 00:00:00 2001 From: Ulrik Andersen Date: Thu, 19 Sep 2024 12:31:15 +0200 Subject: [PATCH] Mention the Gradle plugin in README --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f659c3c0..f8a1297f 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ java -jar fabrikt.jar \ --http-client-opts resilience4j ``` -### Gradle +### Gradle w/ task Here is an example of a Gradle task with code generated to the `build/generated` directory, and execution linked to the compile task. @@ -135,6 +135,28 @@ dependencies { } ``` +### Gradle w/ plugin + +The [Fabrikt Gradle plugin](https://github.com/acanda/fabrikt-gradle-plugin) serves as a convenient wrapper for Fabrikt, +allowing seamless integration of code generation into a Gradle build. + +**Note:** Since the plugin is maintained separately from the Fabrikt library, please refer to the +[Configuration](https://github.com/acanda/fabrikt-gradle-plugin?tab=readme-ov-file#configuration) section of the +plugin's README for the most up-to-date information on how to use it. + +```kotlin +plugins { + id("ch.acanda.gradle.fabrikt") version "1.1.0" // find latest version: https://github.com/acanda/fabrikt-gradle-plugin/releases +} + +fabrikt { + generate("dog") { + apiFile = file("src/main/openapi/dog.yaml") + basePackage = "com.example.api" + } +} +``` + ### Maven The [exec-maven-plugin](http://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-plugin-dependencies.html) is capable of downloading the Fabrikt library from Maven Central and executing its main method with defined arguments.