Skip to content

Commit 52ec2ba

Browse files
authored
Document that plugin adds annotation processors automatically,… (#873)
* docs - Gradle plugin adds annotation processors automatically, and automatic dependencies can be suppressed alternatively. closes #870 * fix example formatting * Add section to explain automatic annotation processors.
1 parent 169c598 commit 52ec2ba

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/docs/asciidoc/index.adoc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ The https://plugins.gradle.org/plugin/io.micronaut.library[Micronaut library plu
306306
* Applies the https://search.maven.org/artifact/io.micronaut.platform/micronaut-platform[Micronaut Bill of Materials (BOM)]
307307
* Applies the `java-library` plugin
308308
* Configures annotation processing for the current language (Groovy, Java or Kotlin)
309+
* <<#sec:automatic-annotation-processors, Adds annotation processors automatically>> for Micronaut modules
309310

310311
The `micronaut` DSL can be used to configure how this behaves.
311312

@@ -1932,6 +1933,52 @@ micronaut {
19321933
In addition, it exposes a `openApiGenerator` configuration which can be used to declare additional dependencies to put on the generator classpath.
19331934
This can be useful in case you want to implement your own generators, in which case you will also have to implement custom tasks which extend the link:api/io/micronaut/gradle/openapi/tasks/AbstractOpenApiGenerator.html[AbstractOpenApiGenerator task type].
19341935

1936+
[[additional-notes]]
1937+
== Additional Notes
1938+
1939+
[[sec:automatic-annotation-processors]]
1940+
=== Automatic annotationProcessor dependencies
1941+
1942+
When the plugin detects you have a dependency with a group id corresponding to a known annotation processor for it, it adds the annotation processor automatically. The following annotation processors are currently supported by this feature.
1943+
1944+
* `io.micronaut.data:micronaut-data-processor`
1945+
* `io.micronaut.jaxrs:micronaut-jaxrs-processor`
1946+
* `io.micronaut.micrometer:micronaut-micrometer-annotation`
1947+
* `io.micronaut.microstream:micronaut-microstream-annotations`
1948+
* `io.micronaut.openapi:micronaut-openapi`
1949+
* `io.micronaut.security:micronaut-security-annotations`
1950+
* `io.micronaut.serde:micronaut-serde-processor`
1951+
* `io.micronaut.spring:micronaut-spring-annotation`
1952+
* `io.micronaut.tracing:micronaut-tracing-annotation`
1953+
* `io.micronaut.validation:micronaut-validation-processor`
1954+
1955+
[[sec:suppress-automatic-dependencies]]
1956+
=== Suppressing automatic dependencies
1957+
1958+
In some circumstances, automatic dependencies – e.g. annotation processors listed above – can get in the way. This should be rare, but it is possible to suppress them, as follows. It has no default and using suppression shifts responsibility of adding the dependencies to the user.
1959+
1960+
.Suppressing automatic dependencies
1961+
[source, groovy, subs="verbatim,attributes", role="multi-language-sample"]
1962+
----
1963+
micronaut {
1964+
// The Micronaut plugins can automatically add dependencies to your project. If, for some reason,
1965+
// a dependency shouldn't be automatically added, you can add its coordinates to this set.
1966+
// The format is "group:name". It must not include the version.
1967+
ignoredAutomaticDependencies.add("io.micronaut.data:micronaut-data-processor")
1968+
}
1969+
----
1970+
1971+
[source, kotlin, subs="verbatim,attributes", role="multi-language-sample"]
1972+
----
1973+
micronaut {
1974+
// The Micronaut plugins can automatically add dependencies to your project. If, for some reason,
1975+
// a dependency shouldn't be automatically added, you can add its coordinates to this set.
1976+
// The format is "group:name". It must not include the version.
1977+
ignoredAutomaticDependencies.add("io.micronaut.data:micronaut-data-processor")
1978+
}
1979+
----
1980+
1981+
19351982
== Upgrade notes
19361983

19371984
=== Upgrading from 2.x
@@ -1971,3 +2018,4 @@ In addition, the official GraalVM plugin makes use of Gradle toolchains support,
19712018
then we recommend tweaking toolchain detection as described in <<#toolchain-behavior, this section of the documentation>>.
19722019

19732020
In any case, make sure to follow the <<#native-image,configuration instructions>>.
2021+

0 commit comments

Comments
 (0)