You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/index.adoc
+82-40Lines changed: 82 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,10 +57,10 @@ Apart from that there are only two options that are recognized inside the config
57
57
processors and placing it directly into the `openapiProcessor` block sets it for all processors.
58
58
59
59
* `checkUpdates`, which allows to enable a version check for the Gradle plugin itself and any processor that supports a version check. It can have one of 3 values:
60
-
+
61
-
* `never`, this is the default and disables all update checks.
62
-
* `daily`, this will check once a day if there is a newer version available. The plugin remembers the last check by writing a timestamp to `build/openapiprocessor/<processor>.yaml`. Without that file the check will run, e.g. after a clean checkout or after running the `clean` task.
63
-
* `always`, this will check on any run of Gradle or a processor task if a newer version is available.
60
+
61
+
** `never`, this is the default and disables all update checks.
62
+
** `daily`, this will check once a day if there is a newer version available. The plugin remembers the last check by writing a timestamp to `build/openapiprocessor/<processor>.yaml`. Without that file the check will run, e.g. after a clean checkout or after running the `clean` task.
63
+
** `always`, this will check on any run of Gradle or a processor task if a newer version is available.
64
64
65
65
To configure a processor, for example xref:spring:ROOT:index.adoc[openapi-processor-spring], place a `spring` configuration into the `openapiProcessor` block. The name of the configuration is used to create a Gradle task `process<Name>` to run the corresponding processor.
It is possible to use multiple `processor` entries to control the dependencies of an openapi-processor.
209
218
+
210
-
For example, the java generating processors depend on `openapi-processor-core`. The `core` library provides most of the logic of a processor, and it is usually enough to update the `core` library to get bugfixes or new features. To find 'SNAPSHOT' versions the plugin automatically adds the snapshot repository to the `repositories`. ([.badge .badge-since]+since 2022.2+, In case you don't want this it is possible to disable adding the snapshot repository by adding `openapi-processor-gradle.snapshots = false` to `gradle.properties`).
219
+
For example, the java generating processors depend on `openapi-processor-core`. The `core` library provides most of the logic of a processor, and it is usually enough to update the `core` library to get bugfixes or new features.
220
+
+
221
+
[NOTE]
222
+
====
223
+
To find 'SNAPSHOT' versions the plugin automatically adds the snapshot repository to the `repositories`.
224
+
225
+
[.badge .badge-since]+since 2022.2+ In case you don't want this it is possible to disable adding the snapshot repository by adding `openapi-processor-gradle.snapshots = false` to `gradle.properties`).
226
+
====
211
227
+
212
228
[tabs]
213
229
====
@@ -265,12 +281,17 @@ The plugin does not add the `process<Name>` task to the build lifecycle.
265
281
To automatically run it
266
282
267
283
* add a task dependency in the `build.gradle` file
268
-
* or use the task output when configuring the additional `SourceSet` directories (see xref:_using_the_processor_output[])
284
+
* or use the task output when configuring the additional `SourceSet` directories (see xref:_using_the_task_output[])
269
285
270
286
The second way is the newer and preferred way.
271
287
272
288
=== `dependOn` a processing task
273
289
290
+
[NOTE]
291
+
====
292
+
This will continue to work but xref:_using_the_task_output[] is the better and preferred configuration.
293
+
====
294
+
274
295
To automatically run a processing task, e.g. `processSpring`, it is necessary to create a dependency on the task.
The Gradle plugin creates the processing tasks inside an `afterEvaluate` block (because its name is configurable). To directly use its name, like in the example below, teh configuration needs to be in an `afterEvaluate` block.
328
+
The Gradle plugin creates the processing tasks inside an `afterEvaluate` block (because its name is configurable). To directly use its name, like in the example below, the configuration needs to be in an `afterEvaluate` block.
308
329
309
330
[source,groovy]
310
331
----
@@ -320,24 +341,25 @@ afterEvaluate {
320
341
}
321
342
----
322
343
323
-
[#_using_the_processor_output]
324
-
== using the processor output
344
+
[#_using_the_task_output]
345
+
== using the task output
325
346
326
347
In case the processor creates java sources it is necessary to compile them as part of the build process.
327
348
328
349
To compile the java source files created by openapi-processor-spring add the `targetDir` of the processor to the java `sourceSets`.
329
350
330
351
There are two ways to configure it:
331
352
332
-
* using a path string, which requires a `dependsOn` configuration
333
-
* or using the task output, which does not need `dependsOn`
353
+
* using a path string which will need the `dependsOn` configuration to trigger the processor before compilation
354
+
* or using the task output, which will avoid the need for `dependsOn`. Gradle will automatically detect that it has to run the processor first.
334
355
335
356
=== by path string
336
357
337
358
Using a path string it is simply added as an additional `srcDir`:
338
359
339
360
[tabs]
340
361
====
362
+
341
363
Kotlin::
342
364
+
343
365
[source,kotlin]
@@ -348,6 +370,7 @@ sourceSets {
348
370
java {
349
371
// add generated files
350
372
srcDir("build/openapi")
373
+
//srcDir(layout.buildDirectory.dir("openapi"))
351
374
}
352
375
}
353
376
}
@@ -362,6 +385,7 @@ sourceSets {
362
385
java {
363
386
// add generated files
364
387
srcDir 'build/openapi'
388
+
//srcDir layout.buildDirectory.dir("openapi")
365
389
}
366
390
}
367
391
}
@@ -402,6 +426,8 @@ sourceSets {
402
426
403
427
=== by task output
404
428
429
+
[.badge .badge-since]+since 2025.1+
430
+
405
431
A preferred approach to avoid `dependsOn` and to support lazy configuration is to use the task output to configure the additional `SourceSet` directories.
0 commit comments