### Full build.gradle (Groovy) Configuration for OpenAPI Processor Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt This Groovy script provides the equivalent configuration to the Kotlin example for the OpenAPI Processor Gradle plugin. It sets up both 'spring' and 'json' processors, defining their dependencies, output directories, and mapping files. ```groovy plugins { id 'io.openapiprocessor.openapi-processor' version '2026.1' } repositories { mavenCentral() } openapiProcessor { apiPath layout.projectDirectory.file("src/api/openapi.yaml") checkUpdates "daily" spring { dependencies { process 'io.openapiprocessor:openapi-processor-spring:2026.1' } targetDir layout.buildDirectory.dir("openapi") mapping layout.projectDirectory.file("src/api/mapping.yaml") } json { dependencies { process 'io.openapiprocessor:openapi-processor-json:2026.1' } targetDir layout.buildDirectory.dir("json") } } sourceSets { main { java { srcDir tasks.named("processSpring") } resources { srcDir tasks.named("processJson") } } } ``` -------------------------------- ### Configure Source Sets with Task Output (Kotlin) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure source sets by referencing task outputs, which supports lazy configuration and avoids explicit `dependsOn`. This example shows creating a new source set and configuring main Java and resources source sets using task outputs. ```kotlin import io.openapiprocessor.gradle.OpenApiProcessorTask sourceSets { create("api") { resources { // add api resources srcDir("${projectDir}/src/api") } } // if the processor generates java files only, directly to targetDir main { java { // add generated files srcDir(tasks.named("processSpring")) } } // if the processor generates java and resource files to the targetDir it is necessary to select the subfolder main { java { // add generated files srcDir(tasks.named("processSpring").map { it.getTargetDir().dir("java") }) } resources { // add generated resources srcDir(tasks.named("processSpring").map { it.getTargetDir().dir("resources") }) } } } ``` -------------------------------- ### Configure OpenAPI Processor with Spring and JSON Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Example of configuring OpenAPI Processor for both Spring and JSON generation. This includes setting API paths, dependencies, and target directories for each processor. ```kotlin // build.gradle.kts openapiProcessor { // the path to the open api YAML file. Usually the same for all processors. // //apiPath("${projectDir}/src/api/openapi.yaml") apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) // based on the name of a processor configuration the plugin creates a Gradle task with name // "process${name of processor}" (in this case "processSpring") to run the processor. // process("spring") { // the openapi-processor-spring dependency (mandatory) // dependencies { process("io.openapiprocessor:openapi-processor-spring:") } // setting api path inside a processor configuration overrides the one at the top. // // apiPath("${projectDir}/src/api/openapi.yaml") // the destination folder for generating interfaces & models. This is the parent of the // {package-name} folder tree configured in the mapping file. (mandatory) // //targetDir("${projectDir}/build/openapi") targetDir(layout.buildDirectory.dir("openapi")) //// openapi-processor-spring specific options //// in a kotlin build script it is necessary to use the prop(key, value) or prop(map) //// method to set processor specific options. // file name of the mapping YAML configuration file. Note that the YAML file name must end // with either {@code .yaml} or {@code .yml}. // //prop("mapping", "${projectDir}/src/api/mapping.yaml") prop("mapping", layout.projectDirectory.file("src/api/mapping.yaml")) } // applying the rule described above the task to run this one is "processJson". // process("json") { // the openapi-processor-json dependency (mandatory) // dependencies { process("'io.openapiprocessor:openapi-processor-json:' } // setting api path inside a processor configuration overrides the one at the top. // // apiPath "${projectDir}/src/api/openapi.yaml" // the destination folder for generating interfaces & models. This is the parent of the // {package-name} folder tree configured in the mapping file. (mandatory) // //targetDir "${projectDir}/build/openapi" targetDir layout.buildDirectory.dir("openapi") //// openapi-processor-spring specific options // file name of the mapping yaml configuration file. Note that the yaml file name must end // with either {@code .yaml} or {@code .yml}. // //mapping "${projectDir}/src/api/mapping.yaml" mapping layout.projectDirectory.file("src/api/mapping.yaml") } // applying the rule described above the task to run this one is "processJson". // json { // the openapi-processor-json dependency (mandatory) // dependencies { processor 'io.openapiprocessor:openapi-processor-json:' } // the destination folder for the json file. (mandatory) //targetDir "${buildDir}/json" targetDir layout.buildDirectory.dir("json") } } ``` -------------------------------- ### Declare Processor Dependency - Pinned Core and Processor Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Example of pinning the core and processor versions separately for fine-grained bugfix control in `build.gradle.kts`. ```kotlin process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") process("io.openapiprocessor:openapi-processor-core:2026.1.1") } targetDir(layout.buildDirectory.dir("openapi")) } ``` -------------------------------- ### Declare Processor Dependency - Local JAR File Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Example of declaring a processor dependency using a local JAR file (e.g., for testing a custom processor) in `build.gradle.kts`. ```kotlin process("custom") { dependencies { process(project.files("libs/my-processor.jar")) } targetDir(layout.buildDirectory.dir("custom")) } ``` -------------------------------- ### Declare Processor Dependency - Standard Maven Coordinate Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Example of declaring a processor dependency using standard Maven coordinates within the `dependencies` block in `build.gradle.kts`. ```kotlin process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } targetDir(layout.buildDirectory.dir("openapi")) } ``` -------------------------------- ### Enable Snapshot Processor Dependencies (Properties) Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Add `openapi-processor-gradle.snapshots=true` to `gradle.properties` to enable snapshot dependencies for processors (not the plugin). ```properties # gradle.properties openapi-processor-gradle.snapshots=true ``` -------------------------------- ### Configure Custom Plugin Repository Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Add a custom repository to `settings.gradle` to use snapshot or test versions of the plugin. This must be at the top of the file. ```groovy // settings.gradle pluginManagement { repositories { maven { url 'https://central.sonatype.com/repository/maven-snapshots' } gradlePluginPortal() } } // ... ``` -------------------------------- ### Configure targetDir for Processor Output Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Specifies the directory where the processor writes its output. Supports string paths, Directory objects, and lazy providers. Using a lazy provider enables Gradle's up-to-date checking and build caching. ```kotlin process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } // String path targetDir("${projectDir}/build/openapi") // Preferred: lazy build directory provider targetDir(layout.buildDirectory.dir("openapi")) } process("json") { dependencies { process("io.openapiprocessor:openapi-processor-json:2026.1") } targetDir(layout.buildDirectory.dir("json")) } ``` -------------------------------- ### Full build.gradle.kts Configuration for OpenAPI Processor Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt This Kotlin script configures openapi-processor-spring and openapi-processor-json side by side. It specifies API paths, check update intervals, and dependency processing for each. The generated code is directed to specific build directories and integrated into the main source sets. ```kotlin import io.openapiprocessor.gradle.OpenApiProcessorTask plugins { kotlin("jvm") version "2.0.0" id("io.openapiprocessor.openapi-processor") version "2026.1" } repositories { mavenCentral() } openapiProcessor { apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) checkUpdates("daily") process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } targetDir(layout.buildDirectory.dir("openapi")) prop("mapping", layout.projectDirectory.file("src/api/mapping.yaml")) } process("json") { dependencies { process("io.openapiprocessor:openapi-processor-json:2026.1") } targetDir(layout.buildDirectory.dir("json")) } } sourceSets { main { java { srcDir(tasks.named("processSpring")) } resources { srcDir(tasks.named("processJson").map { it.getTargetDir() }) } } } ``` -------------------------------- ### Use Snapshot Versions of the Plugin (Groovy) Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Configure the snapshot repository in `settings.gradle` to use snapshot builds of the plugin itself. ```groovy // settings.gradle pluginManagement { repositories { maven { url 'https://central.sonatype.com/repository/maven-snapshots' } gradlePluginPortal() } } // build.gradle plugins { id 'io.openapiprocessor.openapi-processor' version '2026.2-SNAPSHOT' } ``` -------------------------------- ### Apply Plugin - Groovy DSL Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Apply the plugin using its ID in the `settings.gradle` file. Requires Gradle 8.7+. ```groovy plugins { id 'io.openapiprocessor.openapi-processor' version '2026.1' } ``` -------------------------------- ### Apply Plugin - Kotlin DSL Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Apply the plugin using its ID in the `settings.gradle.kts` file. Requires Gradle 8.7+. ```kotlin plugins { id("io.openapiprocessor.openapi-processor") version "2026.1" } ``` -------------------------------- ### Configure Multiple Processor Dependencies (Groovy) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configures the 'spring' processor with explicit dependencies on both the processor library and the core library. This allows for fine-grained control over processor versions, useful for bug fixes or new features in the core library. ```groovy spring { dependencies { processor 'io.openapiprocessor:openapi-processor-spring:2026.2' processor 'io.openapiprocessor:openapi-processor-core:2026.2.1' } } ``` -------------------------------- ### Configure Multiple Processor Dependencies (Kotlin) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configures the 'spring' processor with explicit dependencies on both the processor library and the core library. This allows for fine-grained control over processor versions, useful for bug fixes or new features in the core library. ```kotlin process("spring") { dependencies { processor("io.openapiprocessor:openapi-processor-spring:2026.2") processor("io.openapiprocessor:openapi-processor-core:2026.2.1") } } ``` -------------------------------- ### Configure openapiProcessor in Kotlin DSL Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the openapiProcessor block in a `build.gradle.kts` file. Sets the API path and configures the 'spring' processor. ```kotlin openapiProcessor { // the path to the open api YAML file. apiPath("${projectDir}/src/api/openapi.yaml") // alternatives, since 2025.1 // apiPath(file("$projectDir/src/api/openapi.yaml")) // apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) process("spring") { // ... options of openapi-processor-spring } } ``` -------------------------------- ### Integrate Generated Sources with `dependsOn` (Groovy Legacy) Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Manually ensure the processor runs before compilation by using `dependsOn`. This is a legacy approach. ```groovy // build.gradle (Groovy legacy) sourceSets { main { java { srcDir 'build/openapi' } } } compileJava.dependsOn('processSpring') ``` -------------------------------- ### Integrate Generated Sources with Task Output (Kotlin) Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Reference the task output directly to add generated sources to a SourceSet. Gradle automatically infers task ordering. ```kotlin import io.openapiprocessor.gradle.OpenApiProcessorTask openapiProcessor { apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } targetDir(layout.buildDirectory.dir("openapi")) prop("mapping", layout.projectDirectory.file("src/api/mapping.yaml")) } } sourceSets { main { java { // Reference the task output — Gradle handles ordering automatically srcDir(tasks.named("processSpring")) } } } // If the processor writes both java/ and resources/ subdirectories: sourceSets { main { java { srcDir(tasks.named("processSpring").map { it.getTargetDir().dir("java") }) } resources { srcDir(tasks.named("processSpring").map { it.getTargetDir().dir("resources") }) } } } ``` -------------------------------- ### Register Processor Configuration - Groovy DSL Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Configure a named processor ('spring') in `build.gradle`. Includes dependencies, target directory, and processor-specific properties. Unknown properties are automatically forwarded as processor options. ```groovy openapiProcessor { apiPath layout.projectDirectory.file("src/api/openapi.yaml") spring { dependencies { process 'io.openapiprocessor:openapi-processor-spring:2026.1' } targetDir layout.buildDirectory.dir("openapi") // Groovy DSL: unknown properties are forwarded automatically as processor options mapping layout.projectDirectory.file("src/api/mapping.yaml") } } // Run with: ./gradlew processSpring ``` -------------------------------- ### Register Processor Configuration - Kotlin DSL Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Configure a named processor ('spring') in `build.gradle.kts`. Includes dependencies, target directory, and processor-specific properties. ```kotlin openapiProcessor { apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) process("spring") { // Declare the processor library (mandatory since 2025.1) dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } // Where to write generated sources (mandatory) targetDir(layout.buildDirectory.dir("openapi")) // Processor-specific options use prop(key, value) in Kotlin DSL prop("mapping", layout.projectDirectory.file("src/api/mapping.yaml")) } } // Run with: ./gradlew processSpring ``` -------------------------------- ### Integrate Generated Sources with `dependsOn` (Kotlin Legacy) Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Manually ensure the processor runs before compilation by using `dependsOn`. This is a legacy approach. ```kotlin // build.gradle.kts (legacy approach) sourceSets { main { java { srcDir("build/openapi") } } } // Explicitly trigger processSpring before Kotlin/Java compilation tasks.withType { dependsOn("processSpring") } tasks.withType { dependsOn("processSpring") } ``` -------------------------------- ### Process Multiple OpenAPI Files (Kotlin) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure multiple OpenAPI processor instances with distinct names and processor types. This allows processing different OpenAPI definitions independently within the same Gradle project. ```kotlin // build.gradle.kts openapiProcessor { process("apiOne") { // <1> processorName("spring") // <2> apiPath("${projectDir}/src/api-one/openapi.yaml") // ... options of openapi-processor-spring } process("apiTwo") { // <1> processorName("spring") // <2> apiPath("${projectDir}/src/api-two/openapi.yaml") // ... options of openapi-processor-json } } ``` -------------------------------- ### Process Multiple OpenAPI Files (Groovy) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure multiple OpenAPI processor instances with distinct names and processor types. This allows processing different OpenAPI definitions independently within the same Gradle project. ```groovy // build.gradle openapiProcessor { apiOne { // <1> processorName "spring" // <2> apiPath "${projectDir}/src/api-one/openapi.yaml" // ... options of openapi-processor-spring } apiTwo { // <1> processorName "spring" // <2> apiPath "${projectDir}/src/api-two/openapi.yaml" // ... options of openapi-processor-spring } } ``` -------------------------------- ### Configure apiPath for OpenAPI Source File Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Sets the path to the OpenAPI YAML file. Supports string paths, File objects, and lazy providers. The lazy provider is preferred for configuration cache compatibility. ```kotlin openapiProcessor { // Option 1: string path apiPath("${projectDir}/src/api/openapi.yaml") // Option 2: File object apiPath(file("$projectDir/src/api/openapi.yaml")) // Option 3: lazy provider (preferred — supports configuration cache) apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) process("spring") { // Override the global apiPath for this processor only apiPath(layout.projectDirectory.file("src/api-v2/openapi.yaml")) dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } targetDir(layout.buildDirectory.dir("openapi")) } } ``` -------------------------------- ### Process Multiple OpenAPI Files with the Same Processor Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Uses `processorName()` to decouple the task name from the processor name, allowing multiple configurations to run the same processor on different OpenAPI files. This is useful for managing multiple API definitions. ```kotlin openapiProcessor { process("apiOne") { // creates task: processApiOne processorName("spring") // load openapi-processor-spring apiPath("${projectDir}/src/api-one/openapi.yaml") dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } targetDir(layout.buildDirectory.dir("openapi-one")) prop("mapping", "${projectDir}/src/api-one/mapping.yaml") } process("apiTwo") { // creates task: processApiTwo processorName("spring") // same processor, different inputs apiPath("${projectDir}/src/api-two/openapi.yaml") dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } targetDir(layout.buildDirectory.dir("openapi-two")) prop("mapping", "${projectDir}/src/api-two/mapping.yaml") } } // Run with: ./gradlew processApiOne processApiTwo ``` -------------------------------- ### Configure OpenAPI Processor in Kotlin DSL Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the OpenAPI Processor plugin in a `build.gradle.kts` file. Specify the API path, and configure processing steps for 'spring' and 'json' with their respective dependencies, target directories, and mapping files. ```kotlin // build.gradle.kts openapiProcessor { apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:") } targetDir(layout.buildDirectory.dir("openapi")) prop("mapping", layout.projectDirectory.file("src/api/mapping.yaml")) } process("json") { dependencies { process("io.openapiprocessor:openapi-processor-json:") } targetDir(layout.buildDirectory.dir("json")) } } ``` -------------------------------- ### Configure openapiProcessor in Groovy DSL Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the openapiProcessor block in a `build.gradle` file. Sets the API path and configures the 'spring' processor. ```groovy openapiProcessor { // the path to the open api YAML file. apiPath "${projectDir}/src/api/openapi.yaml" // alternatives, since 2025.1 //apiPath file("$projectDir/src/api/openapi.yaml") //apiPath layout.projectDirectory.file("src/api/openapi.yaml") spring { // ... options of openapi-processor-spring } } ``` -------------------------------- ### Configure Global API Path and Update Checks - Kotlin DSL Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Configure the `openapiProcessor` DSL block in `build.gradle.kts`. Sets a global API path and optionally enables update checks. ```kotlin openapiProcessor { // Global API path — shared by all processors unless overridden per-processor apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) // Optionally enable update checks: "never" (default) | "daily" | "always" checkUpdates("daily") // Log each processor's resolved classpath for debugging // logClasspath(true) } ``` -------------------------------- ### Configure OpenAPI Processor in Groovy DSL Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the OpenAPI Processor plugin in a `build.gradle` file. Specify the API path, and configure processing steps for 'spring' and 'json' with their respective dependencies, target directories, and mapping files. ```groovy // build.gradle openapiProcessor { apiPath layout.projectDirectory.file("src/api/openapi.yaml") spring { dependencies { process "io.openapiprocessor:openapi-processor-spring:" } targetDir layout.buildDirectory.dir("openapi") mapping layout.projectDirectory.file("src/api/mapping.yaml") } json { dependencies { process "io.openapiprocessor:openapi-processor-json:" } targetDir layout.buildDirectory.dir("json") } } ``` -------------------------------- ### Configure multiple processors in Kotlin DSL Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the openapiProcessor block in `build.gradle.kts` to include multiple processors like 'spring' and 'json'. ```kotlin openapiProcessor { // the path to the open api YAML file. apiPath("${projectDir}/src/api/openapi.yaml") // alternatives, since 2025.1 // apiPath(file("$projectDir/src/api/openapi.yaml")) // apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) process("spring") { // ... options of openapi-processor-spring } process("json") { // ... options of openapi-processor-json } } ``` -------------------------------- ### Configure Global API Path and Update Checks - Groovy DSL Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Configure the `openapiProcessor` DSL block in `build.gradle`. Sets a global API path and optionally enables update checks. ```groovy openapiProcessor { apiPath layout.projectDirectory.file("src/api/openapi.yaml") checkUpdates "daily" } ``` -------------------------------- ### Configure multiple processors in Groovy DSL Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the openapiProcessor block in `build.gradle` to include multiple processors like 'spring' and 'json'. ```groovy openapiProcessor { // the path to the open api YAML file. apiPath "${projectDir}/src/api/openapi.yaml" // alternatives, since 2025.1 // apiPath file("$projectDir/src/api/openapi.yaml") // apiPath layout.projectDirectory.file("src/api/openapi.yaml") spring { // ... options of openapi-processor-spring } json { ``` -------------------------------- ### Configure Spring Processor Dependency (Groovy) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configures the 'spring' processor with its required dependency using the preferred shortcut notation. This ensures the processor library is managed separately from project build dependencies. ```groovy spring { dependencies { process 'io.openapiprocessor:openapi-processor-spring:' } } ``` -------------------------------- ### Configure Processor Property (Kotlin) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Sets a processor-specific option using the `prop` method in Kotlin DSL. This passes a key-value pair to the processor for custom configuration. ```kotlin process("spring") { prop("mapping", "..path..") } ``` -------------------------------- ### Configure Spring Processor Dependency (Kotlin) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configures the 'spring' processor with its required dependency using the preferred shortcut notation. This ensures the processor library is managed separately from project build dependencies. ```kotlin process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:") } } ``` -------------------------------- ### Add Generated Resources (Kotlin) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the main resources source set to include generated files from a specified build directory. This is useful for including generated JSON or other resource files in the artifact. ```kotlin sourceSets { main { resources { srcDir("$buildDir/json") } } } ``` -------------------------------- ### Pass Processor-Specific Options with prop() in Kotlin DSL Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Passes arbitrary key-value options to the processor using the `prop()` method in the Kotlin DSL. This is required for custom options. Options can be passed individually or as a map. ```kotlin process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } targetDir(layout.buildDirectory.dir("openapi")) prop("mapping", layout.projectDirectory.file("src/api/mapping.yaml")) prop("beanValidation", true) prop("packageName", "com.example.api") // Pass a map of options at once prop(mapOf( "mapping" to "${projectDir}/src/api/mapping.yaml", "packageName" to "com.example.api" )) } ``` -------------------------------- ### Add Generated Java Sources (Kotlin) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the main Java source set to include generated files from the build directory. This ensures that generated Java code is compiled. ```kotlin sourceSets { main { java { // add generated files srcDir("build/openapi") //srcDir(layout.buildDirectory.dir("openapi")) } } } ``` -------------------------------- ### Add Generated Java Sources (Groovy) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the main Java source set to include generated files from the build directory. This ensures that generated Java code is compiled. ```groovy sourceSets { main { java { // add generated files srcDir 'build/openapi' //srcDir layout.buildDirectory.dir("openapi") } } } ``` -------------------------------- ### Configure Processor Property (Groovy) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Sets a processor-specific option directly as a property in Groovy DSL. Unknown properties are automatically added to the processor options map. ```groovy spring { mapping "..path.." } ``` -------------------------------- ### Add Generated Resources (Groovy) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configure the main resources source set to include generated files from a specified build directory. This is useful for including generated JSON or other resource files in the artifact. ```groovy sourceSets { main { resources { srcDir "$buildDir/json" } } } ``` -------------------------------- ### Configure Automatic Version Update Checks (Kotlin) Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt Control the frequency of version update checks for the plugin and processors. The state is persisted in `build/openapiprocessor/.yaml`. ```kotlin // build.gradle.kts openapiProcessor { apiPath(layout.projectDirectory.file("src/api/openapi.yaml")) // "never" — disabled (default) // "daily" — once per day (state stored in build/openapiprocessor/gradle.yaml) // "always" — on every Gradle invocation checkUpdates("daily") process("spring") { dependencies { process("io.openapiprocessor:openapi-processor-spring:2026.1") } targetDir(layout.buildDirectory.dir("openapi")) } } // If a newer version is available, a quiet log message is printed during the run: // > openapi-processor-spring version 2026.2 is available! I'm version 2026.1. ``` -------------------------------- ### Ensure API Generation Before Compilation (Kotlin) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configures Kotlin compilation tasks to depend on the 'processSpring' task, ensuring API sources are generated before compilation begins. This is a way to integrate processor output into the build lifecycle. ```kotlin import org.jetbrains.kotlin.gradle.tasks.KotlinCompile // generate api before compiling tasks.withType { dependsOn("processSpring") } // generate api resource before processing tasks.withType { dependsOn("processSpring") } ``` -------------------------------- ### Pass Processor-Specific Options in Groovy DSL Source: https://context7.com/openapi-processor/openapi-processor-gradle/llms.txt In Groovy DSL, any unknown property assigned directly to the processor configuration block is automatically collected as a processor option. ```groovy spring { dependencies { process 'io.openapiprocessor:openapi-processor-spring:2026.1' } targetDir layout.buildDirectory.dir("openapi") mapping layout.projectDirectory.file("src/api/mapping.yaml") beanValidation true packageName "com.example.api" } ``` -------------------------------- ### Ensure API Generation Before Compilation (Groovy) Source: https://github.com/openapi-processor/openapi-processor-gradle/blob/master/docs/modules/ROOT/pages/index.adoc Configures the Java compilation task to depend on the 'processSpring' task, ensuring API sources are generated before compilation begins. This is a way to integrate processor output into the build lifecycle. ```groovy // generate api before compiling compileJava.dependsOn ('processSpring') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.