Skip to content

Commit 97af782

Browse files
committed
Merge pull request #22000 from mla-mpensdavila
* pr/22000: Polish "Document how to exclude an annotation processor with Maven" Document how to exclude an annotation processor with Maven Closes gh-22000
2 parents f656083 + 9b803af commit 97af782

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,30 @@ With Maven the dependency should be declared as optional, as shown in the follow
708708
</dependency>
709709
----
710710

711+
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:
712+
713+
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
714+
----
715+
<project>
716+
<build>
717+
<plugins>
718+
<plugin>
719+
<groupId>org.springframework.boot</groupId>
720+
<artifactId>spring-boot-maven-plugin</artifactId>
721+
<configuration>
722+
<excludes>
723+
<exclude>
724+
<groupId>org.springframework.boot</groupId>
725+
<artifactId>spring-boot-configuration-processor</artifactId>
726+
</exclude>
727+
</excludes>
728+
</configuration>
729+
</plugin>
730+
</plugins>
731+
</build>
732+
</project>
733+
----
734+
711735
With Gradle 4.5 and earlier, the dependency should be declared in the `compileOnly` configuration, as shown in the following example:
712736

713737
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]

spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7594,6 +7594,30 @@ It is recommended to add the following dependency in a module that contains auto
75947594
</dependency>
75957595
----
75967596

7597+
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:
7598+
7599+
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
7600+
----
7601+
<project>
7602+
<build>
7603+
<plugins>
7604+
<plugin>
7605+
<groupId>org.springframework.boot</groupId>
7606+
<artifactId>spring-boot-maven-plugin</artifactId>
7607+
<configuration>
7608+
<excludes>
7609+
<exclude>
7610+
<groupId>org.springframework.boot</groupId>
7611+
<artifactId>spring-boot-autoconfigure-processor</artifactId>
7612+
</exclude>
7613+
</excludes>
7614+
</configuration>
7615+
</plugin>
7616+
</plugins>
7617+
</build>
7618+
</project>
7619+
----
7620+
75977621
With Gradle 4.5 and earlier, the dependency should be declared in the `compileOnly` configuration, as shown in the following example:
75987622

75997623
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]

0 commit comments

Comments
 (0)