From 627c0b1031334299905d6aa804333529a17ce1ad Mon Sep 17 00:00:00 2001 From: Marco Pens Date: Mon, 15 Jun 2020 22:20:39 -0300 Subject: [PATCH 1/2] Document how to exclude an annotation processor with Maven See gh-22000 --- .../main/asciidoc/spring-boot-features.adoc | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 8dfdf747dc1a..e0e2dc8ab7c9 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -7583,15 +7583,42 @@ If you do it that way, the library is not provided and, by default, Spring Boot Spring Boot uses an annotation processor to collect the conditions on auto-configurations in a metadata file (`META-INF/spring-autoconfigure-metadata.properties`). If that file is present, it is used to eagerly filter auto-configurations that do not match, which will improve startup time. -It is recommended to add the following dependency in a module that contains auto-configurations: +It is recommended to add the following dependency in a module that contains auto-configurations and exclude it in the `spring-boot-maven-plugin` to prevent the repacking task from adding the dependency into the fat jar: [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- - - org.springframework.boot - spring-boot-autoconfigure-processor - true - + + ... + + + org.springframework.boot + spring-boot-autoconfigure-processor + + + + ... + + ... + + org.springframework.boot + spring-boot-maven-plugin + + + ... + + org.springframework.boot + spring-boot-autoconfigure-processor + + + + ... + + ... + + ... + + ... + ---- With Gradle 4.5 and earlier, the dependency should be declared in the `compileOnly` configuration, as shown in the following example: From 9b803af3c3e29c255815581f16a33c879ecbd82f Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 19 Jun 2020 11:36:25 +0200 Subject: [PATCH 2/2] Polish "Document how to exclude an annotation processor with Maven" See gh-22000 --- .../appendix-configuration-metadata.adoc | 24 ++++++++ .../main/asciidoc/spring-boot-features.adoc | 61 +++++++++---------- 2 files changed, 53 insertions(+), 32 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc index ab4d6a782c76..b8e6b490c1c2 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc @@ -708,6 +708,30 @@ With Maven the dependency should be declared as optional, as shown in the follow ---- +If you have defined `@ConfigurationProperties` in your application, make sure to configure the `spring-boot-maven-plugin` to prevent the `repackage` goal from adding the dependency into the fat jar: + +[source,xml,indent=0,subs="verbatim,quotes,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.springframework.boot + spring-boot-configuration-processor + + + + + + + +---- + With Gradle 4.5 and earlier, the dependency should be declared in the `compileOnly` configuration, as shown in the following example: [source,groovy,indent=0,subs="verbatim,quotes,attributes"] diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index e0e2dc8ab7c9..6d591e0c1324 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -7583,42 +7583,39 @@ If you do it that way, the library is not provided and, by default, Spring Boot Spring Boot uses an annotation processor to collect the conditions on auto-configurations in a metadata file (`META-INF/spring-autoconfigure-metadata.properties`). If that file is present, it is used to eagerly filter auto-configurations that do not match, which will improve startup time. -It is recommended to add the following dependency in a module that contains auto-configurations and exclude it in the `spring-boot-maven-plugin` to prevent the repacking task from adding the dependency into the fat jar: +It is recommended to add the following dependency in a module that contains auto-configurations: + +[source,xml,indent=0,subs="verbatim,quotes,attributes"] +---- + + org.springframework.boot + spring-boot-autoconfigure-processor + true + +---- + +If you have defined auto-configurations directly in your application, make sure to configure the `spring-boot-maven-plugin` to prevent the `repackage` goal from adding the dependency into the fat jar: [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- - ... - - - org.springframework.boot - spring-boot-autoconfigure-processor - - - - ... - - ... - - org.springframework.boot - spring-boot-maven-plugin - - - ... - - org.springframework.boot - spring-boot-autoconfigure-processor - - - - ... - - ... - - ... - - ... - + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.springframework.boot + spring-boot-autoconfigure-processor + + + + + + + ---- With Gradle 4.5 and earlier, the dependency should be declared in the `compileOnly` configuration, as shown in the following example: