{"id":37425539,"url":"https://github.com/cloudflightio/autoconfigure-gradle-plugin","last_synced_at":"2026-01-16T06:13:14.257Z","repository":{"id":36963228,"uuid":"455311331","full_name":"cloudflightio/autoconfigure-gradle-plugin","owner":"cloudflightio","description":"This Gradle plugin is an opinionated approach to configure a Gradle project automatically by convention. It supports to automatically configure various plugins to reduce boilerplate code in Gradle projects.","archived":false,"fork":false,"pushed_at":"2025-04-09T20:06:22.000Z","size":5814,"stargazers_count":31,"open_issues_count":8,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-09T21:21:11.634Z","etag":null,"topics":["gradle-plugin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflightio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-03T20:07:01.000Z","updated_at":"2025-04-09T20:03:16.000Z","dependencies_parsed_at":"2023-10-30T14:27:11.191Z","dependency_job_id":"dbe72c2e-e699-446d-90b1-470773b6a3b4","html_url":"https://github.com/cloudflightio/autoconfigure-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"purl":"pkg:github/cloudflightio/autoconfigure-gradle-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Fautoconfigure-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Fautoconfigure-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Fautoconfigure-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Fautoconfigure-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflightio","download_url":"https://codeload.github.com/cloudflightio/autoconfigure-gradle-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Fautoconfigure-gradle-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T03:13:13.607Z","status":"ssl_error","status_checked_at":"2026-01-16T03:11:47.863Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle-plugin"],"created_at":"2026-01-16T06:13:13.049Z","updated_at":"2026-01-16T06:13:14.237Z","avatar_url":"https://github.com/cloudflightio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gradle AutoConfigure Plugin\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/io.cloudflight.autoconfigure-gradle?logo=gradle\u0026label=Gradle%20Plugin%20Portal)](https://plugins.gradle.org/plugin/io.cloudflight.autoconfigure-gradle)\n\nThis plugin is an opinionated approach to configure a Gradle project automatically by convention. \nIt supports to automatically configure various plugins to reduce boilerplate code in Gradle projects.\n\nAs an example, instead of applying the Kotlin Plugin manually, the AutoConfigure-Plugin does that automatically for you\nwhen we detect a folder `src/main/kotlin` inside your module, and we also automatically configure the Kotlin\nplugin with sensible defaults (encoding, JVM runtime).\n\nThe idea is similar to Spring Boot, where beans are being auto-generated and auto-configured based on the current classpath.\n\n## Requirements\n\nThis plugin requires at least Gradle 8.13 and Java 21. You can still configure this plugin to use Java 8 (or any other Java version)\nto compile your codebase.\n\n## Installation\n\nThere are two different ways how to apply the AutoConfigure plugin:\n\n1. As normal project plugin inside `build.gradle` or `build.gradle.kts`\n2. As settings-plugin inside `settings.gradle` or `settings.gradle.kts`\n\nWhere the latter approach has the advantage that we also include the awesome [Reckon-Plugin](https://github.com/ajoberstar/reckon) \nfor semantic versioning\n\n### Install as project plugin\n\nYou can apply that plugin via the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/io.cloudflight.autoconfigure-gradle)\nby adding the following block to your `build.gradle.kts`:\n\n````kotlin\nplugins {\n    id(\"io.cloudflight.autoconfigure-gradle\") version \"1.0.1\"\n}\n````\n\nThis plugin is meant to be applied only at the root module of your project - never on sub-modules if you have one.\nAll the plugin does by itself is scan the module and all sub-modules and apply\nany of the internal plugins mentioned below depending on the layout. Instead of requiring you\nto apply the same default over and over again, we do that automatically for you.\n\n### Install as settings plugin\n\nAlternatively, you can also apply the AutoConfigure-Plugin as Settings plugin in your `settings.gradle.kts`:\n\n````kotlin\nplugins {\n    id(\"io.cloudflight.autoconfigure-settings\") version \"1.0.1\"\n}\n````\n\nIn case your [code is running on a CI-Server](https://github.com/cloudflightio/ci-info), we will then automatically apply the [Reckon-Plugin](https://github.com/ajoberstar/reckon) for you in \nand pre-configure it with the following defaults:\n\n````groovy\nreckon {\n    stages('rc', 'final')\n    scopeCalc = calcScopeFromProp()\n    stageCalc = calcStageFromProp()\n    defaultInferredScope = 'patch'\n}\n````\n\nIf this is fine for you, you don't need to add anything to your `settings.gradle`, but feel free to override\nthis with any of your desired values.\n\nIn any way, you can omit the `version` property from your `build.gradle` file then, Reckon will take care of it.\n\nIf you are not running on a CI-Server (i.e. you are doing local development), the Reckon-Plugin is NOT applied, instead\nwe set the version to the `-SNAPSHOT` or the last reckoned version as described in [this ticket](https://github.com/cloudflightio/autoconfigure-gradle-plugin/issues/114) (but you're free to override that in the `build.gradle` temporarily). \nThat means if the Reckon plugin would create `0.8.5-rc.0.0+20221111T075331Z`, we convert that to `0.8.5-SNAPSHOT` locally. The reason for this behaviour is [this ticket](https://github.com/ajoberstar/reckon/issues/189).\n\nIn any case, when applying the Settings-Plugin, we will also automatically apply the `io.cloudflight.autoconfigure-gradle` plugin for you, so you don't need\nto do that on your own. \n\n\n## Samples\n\nA good starting point to understand how this plugin works might be to go through our [samples of real-life applications](samples/samples.md).\n\n## Plugins\n\nThis plugin consists of multiple sub-plugins, all of which are being applied automatically when \ncertain functionality is being detected (i.e. we automatically apply the Java Plugin when we detect \na source folder `src/main/java`). \n\n### Java Plugin\n\nIf the plugin detects either the folder `src/main/java` or `src/test/java` in a module, it automatically\napplies the `java` plugin. If you need the `java-library` plugin in a specific module\nyou can apply it by adding the following to the module's `build.gradle.kts`:\n```kotlin\nplugins{\n    id(\"java-library\")\n}\n```\n\nThe `java` plugin applies the following configuration:\n\n#### Configuration\n\nYou can provide some configuration to this plugin by adding the following block to \nyour `build.gradle.kts`:\n\n````kotlin\njavaConfigure {\n    languageVersion.set(JavaLanguageVersion.of(21))\n    vendorName.set(\"Cloudflight\")\n    applicationBuild.set(false)\n    encoding.set(\"UTF-8\")\n    createSourceArtifacts.set(false)\n}\n````\n\nThe usage of those properties will be explained in the sections below:\n\n#### Java Compatibility\n\nBased on the `langageVersion` in your `JavaConfigurePluginExtension` we will set the [Java Toolchain](https://docs.gradle.org/current/userguide/toolchains.html)\nfor you and also use it in the Manifest, the default being Java 21. \n\nThe encoding will be set automatically to all source sets, the default being UTF-8.\n\n#### Unit-Test Configuration\n\nThe test task is automatically configured with `useJUnitPlatform()` to use the JUnit5 Platform per default. You do need to add the necessary dependencies yourself as described [here](https://docs.gradle.org/current/userguide/java_testing.html#compiling_and_executing_junit_jupiter_tests).\n\nTo override the used testing platform use:\n```kotlin\ntasks.test {\n    useJUnit()\n}\n```\n\n#### Jacoco\n\nThis plugin also automatically applies the [Jacoco-Plugin](https://docs.gradle.org/current/userguide/jacoco_plugin.html)\nin order to collect code-coverage information during our unit- and integration tests.\n\nCall `gradle testCodeCoverageReport` to get a multi-module coverage report over all your modules in the\n`build/reports/jacoco/testCodeCoverageReport/html` directory of your root module.\n\n#### MANIFEST.MF\n\nWe automatically configure the task `jar.manifest` in order to create manifests like that:\n\n````\nManifest-Version: 1.0\nClass-Path: jsr305-3.0.2.jar\nCreated-By: 17.0.2 (Eclipse Adoptium)\nImplementation-Vendor: your-vendor-name\nImplementation-Title: my-module\nImplementation-Version: 0.0.1\nGradle-Version: 7.3.3\n````\n\n* The `Class-Path` is created automatically from your `runtime` configuration\n* `Gradle-Version` and `Created-By` are being taken from your current environment\n* `Implementation-Version` is being set to the current `project.version`\n* `Implementation-Title` is your `project.name`\n* The `Implementation-Vendor` can be set by configuring the `vendorName` in the `JavaConfigurePluginExtension` (see above)\n\n#### Artifacts\n\nPer default the source and javadoc jars will be generated for all builds that have the property `applicationBuild` set to `false`.   \nIf you want to change that behavior you can manually set the `createSourceArtifacts` depending on the desired outcome.\n\n### Test Fixtures\n\nIf the folder `src/testFixtures` exists, we automatically apply the plugin [`java-test-fixtures`](https://docs.gradle.org/current/userguide/java_testing.html#sec:java_test_fixtures),\nyou don't need to apply it on your own.\n\n### Kotlin Plugin\n\nIf the plugin detects either the folder `src/main/kotlin` or `src/test/kotlin` in a module, it automatically\napplies the [Kotlin Gradle Plugin](https://kotlinlang.org/docs/gradle.html) and applies the following configuration:\n\n#### Configuration\n\nYou can provide some configuration to this plugin by adding the following block to\nyour `build.gradle.kts`:\n\n````kotlin\nkotlinConfigure {\n    kotlinVersion.set(\"1.6.10\")\n}\n````\n\nThe Kotlin plugin also automatically applies the Java Plugin with all its configuration possibilities. Use the configuration\nthere to adjust the JDK or the Manifest entries.\n\n#### Kotlin Version\n\nPer default, we are using the latest version of the Kotlin Plugin (1.8.0) to compile your Kotlin-Code. Still,\nyou can specify an older version (i.e. 1.5.20), which results in the following behaviour:\n\n* The Kotlin StdLib of the version `1.5.20` is being added to the classpath\n* The `apiVersion` and `languageVersion` is set to `1.5`, see [this link](https://kotlinlang.org/docs/gradle.html#attributes-common-to-jvm-and-js) for more details\n* The setting `-Xjsr305=strict` is being added to the Kotlin Compiler options, see [this link](https://kotlinlang.org/docs/java-interop.html#jsr-305-support) for more details\n\n## Node-Plugin\n\nApply the plugin `io.cloudflight.autoconfigure.node-configure` in order to configure the [Gradle Node Plugin](https://github.com/node-gradle/gradle-node-plugin)\n\n````kotlin\nplugins {\n    id(\"io.cloudflight.autoconfigure.node-configure\")\n}\n````\n\nYou can configure this plugin with the `NodeConfigurePluginExtension` as follows:\n\n````kotlin\nnodeConfigure {\n    nodeVersion = \"16.15.1\"\n    downloadNode = true\n    npmVersion = \"6.14.10\"\n    inputFiles = [\n        fileTree('node_modules'),\n        fileTree('src'),\n        file('package.json'),\n        file('tsconfig.json')\n    ]    \n}\n````\n\nThese values shown here are also the default values, so you can omit them, i.e. if you're fine with this values simply don't configure anything.\n\nYou then automatically get the following tasks:\n\n| Task         | Description                                                                                                                                   |\n|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `clfNpmBuild` | Runs `npm run build`. Automatically being called during compilation.                                                                          |\n| `clfNpmBuildDev` | Runs `npm run build:dev`. Use this target to have live reloading supported.                                                                   |\n| `clfNpmLint` | Runs `npm run lint`. Automatically being called in the check-phase (right after compilation).                                                 |\n| `clfNpmTest` | Runs `npm run test`. This task is automatically being attached to the `test` target, if your `package.json` contains a `test` script.         |\n| `clfNpmUpdateVersion` | Updates the version in your `package.json` to the current value in `build.gradle`. This task is only being called in CI-Servers automatically |\n\nThe Node-Configure-Plugin takes care about dependencies between this tasks, as well as inputs and outputs and up-to-date-handling.\n\n## Swagger Plugin\n\nWhen it comes to the definition of APIs over HTTP, Swagger/OpenAPI is the defacto-standard nowadays. Code generation is an important part there, and there exist a couple of libraries out there, to generate code from or to OpenAPI specifications.\n\nThis plugin preconfigures both the  for API generation [Swagger Gradle Plugin](https://github.com/gigaSproule/swagger-gradle-plugin)\nand the [Swagger Generator Plugin](https://github.com/int128/gradle-swagger-generator-plugin) for code generation. \n\nWhile both of them are really powerful and flexible, they all have some downsides:\n\n* They resolve dependencies too early and do not play well with the Java Platform Plugin for central dependency constraints.\n* It’s not easy to configure the plugins in a way to have the task order applied in the correct way (i.e. which task is being dependent on what when it comes to code generation)\n* Their dynamic configuration makes it hard to provide sensible defaults.\n* They are coming with a lot of transitive dependencies, some of them incompatible with important other plugins like the Spring Boot plugin.\n\nWith some extra-code within this plugin we managed to find a solution that fullfils all these \nrequirements while keeping the flexibility of the underlying plugins.\n\nIn order to support all possibible use cases, there is one important thing to understand: \nSwagger/OpenAPI specifictions (yaml or json) always need to be in another module than the code that is being generated out of it.\n\nSo we always see the whole setup as two steps:\n\n1. Manage your API specifications (either by generating API spcifications from code, or by importing external specifications)\n2. Generate code from Swagger/OpenAPI\n\n\n### Manage your API specifications\n\n#### Generate from code\n\nOur recommended way to work with OpenAPI clients is to write APIs interfaces and DTOs in \nJava or Kotlin code, annotate them with Spring and OpenAPI annotations and then generate the \nOpenAPI specification from there, and use that in turn to generate other clients like for Typescript.\n\nThe module `skeleton-api` only contains Java/Kotlin interfaces along with their DTOs and all \nSpring MVC annotations to define the API contract to that server. \nThe according `build.gradle` file looks like that:\n\n````groovy\nplugins {\n    id \"io.cloudflight.autoconfigure.swagger-api-configure\"\n}\n\ndependencies {\n    implementation 'io.swagger:swagger-annotations'\n    implementation 'org.springframework:spring-web'\n}\n````\n\nBy doing this, the build will generate API definitions in JSON and YAML format to the directory `skeleton-api/build/generated/resources/openapi`.\nThe task which is doing this, is called `clfGenerateSwaggerDocumentation` and it is triggered \nautomatically before calling the `jar` task.\n\nThis task wraps the `GenerateSwaggerDocsTask` of the plugin mentioned above and configures it automatically with those values:\n\n````groovy\nswagger {\n    apiSource {\n        locations = [\n            project.group + '.api',\n            project.group + '.api.dto'\n        ]\n    }\n}\n````\n\nThat means, if the groupId of your project (to be set in the root `build.gradle`) \nis `io.cloudflight.skeleton`, then your API interfaces need to be in the package `io.cloudflight.skeleton.api` (or a subpackage of it) \nand your DTOs in the package `io.cloudflight.skeleton.api.dto`.\n\nAdditionally, the Autoconfigure Gradle Plugin will create an additional maven publication, \nthat means the YAML and JSON files are also being published to your artifact repository like Nexus \nand you can fetch it from there like JAR files.\n\n\n#### API from file\n\nIn case you have to embed an external OpenAPI specification, or for any reason you want to \nmaintain your own OpenAPI specification instead of writing code, you can do that as well.\n\nIn order to take part in the advanced dependency resolution that have been implemented \nwithin this plugin on top of the official Swagger plugin, you have to put those OpenAPI \nfiles into a separate gradle/maven module:\n\nYour module structure might look like that:\n\n````\nexternalsystem-api\n  build.gradle\n  myopenapifile.yml\nmyproject-server\n  build.gradle\nmyproject-ui\n  package.json\n  build.gradle\n````\n\nWe are focussing on the module `externalsystem-api` now, the `build.gradle` looks as follows:\n\n````groovy\napply plugin: 'java'  \n\nartifacts.add(JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME, file('myopenapifile.yml')) {   \n    name project.name\n    classifier 'swagger'\n    type 'yaml' \n}\n````\n\n* We need to apply the Java plugin manually here, as we don’t have a folder `src/main/java` here. \n* Refer to your OpenAPI or Swagger configuration file and create a publication. \n* If you OpenAPI or Swagger configuration file is provided in JSON format, you can alternatively specify json as type here.\n\nThat’s it. Your OpenAPI specification (Whereever it comes from) is now registered and can be used later as reference for code generation.\n\n### Generate code from Swagger/OpenAPI\n\nNow that we have defined our API modules, we can use them to generate code from it. To achieve that, simply apply the \nplugin `io.cloudflight.autoconfigure.swagger-codegen-configure` and create a dependency within the configuration \n`swaggerApi` to your API module.\n\nThis plugin applies the necessary swaggerSources configuration for the [Swagger Generator Plugin](https://github.com/int128/gradle-swagger-generator-plugin) \nso that you don't have to do anything extra. The minimal configuration is nothing more than that:\n\n````groovy\nplugins {\n    id 'io.cloudflight.autoconfigure.swagger-codegen-configure'\n}\n\ndependencies {\n    swaggerApi project(':api')\n}\n````\n\nDependending of the layout of the module which applies `io.cloudflight.autoconfigure.swagger-codegen-configure`, code is\nbeing generated with the following defaults (the rules are evaluated top down, first match is being applied):\n\n\n| Rule                            | `swaggerGenerator`   | `swaggerLibrary` |\n|---------------------------------|----------------------|------------------|\n| The Node plugin is applied      | `typescript-angular` | `null`           |\n| Module name ends with `-client` | `spring`             | `spring-cloud`   |\n| Default                         | `spring`             | `spring-boot`    |\n\nTarget packages are derived from the project `group`.\n\nIn rare occasions the applied defaults do not work, in that case you can simply add or overwrite the \nmissing configuration as you would if you were using the [Swagger Generator Plugin](https://github.com/int128/gradle-swagger-generator-plugin) without the \nAutoConfigure Plugin:\n\n````groovy\nswaggerSources {\n    'externalsystem-api' { \n        code {\n            additionalProperties = [\n                'delegatePattern' : 'true'\n            ]\n        }\n    }\n}\n````\n\nPlease note that the configuration name (`externalsystem-api` in that case) has to match the name of the referenced module or dependency.\n\nA more complex configuration would be:\n\n````groovy\nswaggerSources {\n    'hub-api-definition' {\n        code {\n            language = \"java\"\n            library = \"resttemplate\"\n            components = [apis: true, apiTests: false, supportingFiles: true]\n            additionalProperties = [\n                'invokerPackage': \"io.cloudflight.commons.hub\",\n                'apiPackage'  : \"io.cloudflight.commons.hub.client\",\n                'modelPackage'  : \"io.cloudflight.commons.hub.dto\"\n            ]\n        }\n    }\n}\n````\n\n#### Exchanging the generator CLI\n\nPer default, we are using the module `io.swagger.codegen.v3:swagger-codegen-cli:3.0.34` as code generator library.\n\nThere are two ways to override that:\n\n1. override the property `swaggerCodegenCliVersion` in your `build.gradle` to use another version of `io.swagger.codegen.v3:swagger-codegen-cli`.\n````groovy\nswaggerCodgenConfigure {\n    swaggerCodegenCliVersion = \"3.0.30\"\n}\n````\n2. define your own generator within the `swaggerCodegen` as described in the [official plugin documentation](https://github.com/int128/gradle-swagger-generator-plugin#code-generation).\n\n#### Setting the generator for node projects\n\n`typescript-angular` is the default generator for node projects. This is not what you want in case you are using other frameworks.\n\nTo change the generator, override the property `nodeSwaggerGenerator` in your `build.gradle`.\n````groovy\nswaggerCodgenConfigure {\n    nodeSwaggerGenerator = \"typescript-fetch\"\n}\n````\n\n#### Adding custom templates\n\nYou can also define your own artifacts containg mustache templates for code generation, simply add a dependency within the `swaggerTemplate` configuration\nand refer to a JAR that contains the updates mustache files:\n\n````groovy\ndependencies {\n    swaggerApi project(':api')\n\n    swaggerTemplate \"\u003cyour-jar-with-mustache-templates\u003e\"\n}\n````\n\n## SpringDoc OpenApi plugin\n\nThis autoconfigures the Gradle plugin provided by the [SpringDoc OpenApi](https://github.com/springdoc/springdoc-openapi-gradle-plugin) project.\n\nSpringDoc OpenApi has a different approach than the above explained swagger plugin.\nIt needs a running Spring Boot application that serves the OpenAPI document.\n\nThe autoconfiguration for this plugin is applied as follows:\n\n```groovy\nplugins {\n    id 'io.cloudflight.autoconfigure.springdoc-openapi-configure'\n}\n```\n\nThe plugin has to be applied to a module that provides a Spring Boot application which the plugin will try to start using a custom Spring Boot run configuration.   \nThis custom run configuration will be started in a dummy working directory to work around a issue currently present in the springdoc plugin. You can find more information [here](https://github.com/cloudflightio/autoconfigure-gradle-plugin/issues/171).\nThe dummy working directory is created with a task called `createDummyForkedSpringBootWorkingDir`. Various other tasks are automatically configured to depend on this, since they access the dummy directory for some reason.\n\n\u003cdetails\u003e\n\u003csummary\u003eIf you run into some problems with the task, try adding it as a dependency to your task by adding the following.\u003c/summary\u003e\n\n```groovy\ntasks.named(\"your-task-name\") {\n    dependsOn(\"createDummyForkedSpringBootWorkingDir\")\n}\n```\n\nIf you have multiple tasks that need to depend on it you can do:\n\n```groovy\ndef taskList = [\"your-task-1\", \"your-task-2\"]\ntasks.matching { taskList.contains(it.name) }.all {\n    dependsOn(\"createDummyForkedSpringBootWorkingDir\")\n}\n```\n\u003c/details\u003e\n\nThe springdoc plugin is automatically configured to generate the open-api spec in `YAML` format. If you prefer the `JSON` format you can easily change that by using our extension:\n```groovy\nimport io.cloudflight.gradle.autoconfigure.springdoc.openapi.OpenApiFormat\n\nopenApiConfigure {\n    fileFormat = OpenApiFormat.JSON\n}\n```\n\nFor generating the OpenAPI document the task `clfGenerateOpenApiDocumentation` has to be run.\n\n### Grouped Apis\n\nIn case you are using [grouped api configuration](https://springdoc.org/faq.html#_how_can_i_define_multiple_openapi_definitions_in_one_spring_boot_project) in your project, instead of something like this (as described in [springdoc gradle plugin](https://github.com/springdoc/springdoc-openapi-gradle-plugin#customization))\n\n```groovy\nopenApi {\n    groupedApiMappings = [\n            \"http://localhost:8080/v3/api-docs/groupA\": \"groupA.yaml\",\n            \"http://localhost:8080/v3/api-docs/groupB\": \"groupB.yaml\"\n    ]\n}\n```\n\nyou have to use the configuration provided by this plugin, since the port of the spring application will be randomly selected\n\n```groovy\nopenApiConfigure {\n    groupedApiMappings = [\n            \"/v3/api-docs/groupA\": \"groupA.yaml\",\n            \"/v3/api-docs/groupB\": \"groupB.yaml\"\n    ]\n}\n```\n\nTo provide other custom configuration just add the openApi extension configuration block.\nSee https://github.com/springdoc/springdoc-openapi-gradle-plugin#customization.\n\n```groovy\nopenApi {\n    outputDir=buildDir\n}\n```\n\n## Auto-Configuration\n\nIn multi-module projects, each of the above mentioned plugins can be configured on a per-module basis,\nbut you can also use the `autoConfigure` extension of this plugin to set defaults for all submodules without\niterating through all modules by yourself.\n\nTo achieve that, add the following block to your root module `build.gradle.kts` in a multi-module project:\n\n````kotlin\nautoConfigure {\n    java {\n        languageVersion.set(JavaLanguageVersion.of(17))\n        encoding.set(\"UTF-16\")\n        vendorName.set(\"My cool company\")\n    }\n    kotlin {\n        kotlinVersion.set(\"1.5.31\")\n    }\n}\n````\n\nEach property here comes with an equivalent to the above mentioned sub-plugins. If you set a default value\non the root module here, and override it with a more specific value in the sub-module, then the latter will\nalways win.\n\n### Version and Group\n\nTo reduce unnecessary code for setting the version and group of all sub-modules we automatically set the version and group\nof all sub-modules to the values defined for the root-module.   \nIf you want to have a different version or group, just define it in the sub-module. Any values defined in the `build.gradle` of a sub-module will not be overridden.\n```kotlin\nversion = \"1.1.1\"\ngroup = \"com.project.module.other.group\"\n```\n\n## Contributing\n\n-   [Contributing to the project](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflightio%2Fautoconfigure-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflightio%2Fautoconfigure-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflightio%2Fautoconfigure-gradle-plugin/lists"}