Skip to content

Commit 627c0b1

Browse files
mpenssnicoll
authored andcommitted
Document how to exclude an annotation processor with Maven
See gh-22000
1 parent f656083 commit 627c0b1

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

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

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7583,15 +7583,42 @@ If you do it that way, the library is not provided and, by default, Spring Boot
75837583

75847584
Spring Boot uses an annotation processor to collect the conditions on auto-configurations in a metadata file (`META-INF/spring-autoconfigure-metadata.properties`).
75857585
If that file is present, it is used to eagerly filter auto-configurations that do not match, which will improve startup time.
7586-
It is recommended to add the following dependency in a module that contains auto-configurations:
7586+
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:
75877587

75887588
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
75897589
----
7590-
<dependency>
7591-
<groupId>org.springframework.boot</groupId>
7592-
<artifactId>spring-boot-autoconfigure-processor</artifactId>
7593-
<optional>true</optional>
7594-
</dependency>
7590+
<project>
7591+
...
7592+
<dependencies>
7593+
<dependency>
7594+
<groupId>org.springframework.boot</groupId>
7595+
<artifactId>spring-boot-autoconfigure-processor</artifactId>
7596+
</dependency>
7597+
</dependencies>
7598+
<build>
7599+
...
7600+
<plugins>
7601+
...
7602+
<plugin>
7603+
<groupId>org.springframework.boot</groupId>
7604+
<artifactId>spring-boot-maven-plugin</artifactId>
7605+
<configuration>
7606+
<excludes>
7607+
...
7608+
<exclude>
7609+
<groupId>org.springframework.boot</groupId>
7610+
<artifactId>spring-boot-autoconfigure-processor</artifactId>
7611+
</exclude>
7612+
</excludes>
7613+
</configuration>
7614+
...
7615+
</plugin>
7616+
...
7617+
</plugins>
7618+
...
7619+
</build>
7620+
...
7621+
</project>
75957622
----
75967623

75977624
With Gradle 4.5 and earlier, the dependency should be declared in the `compileOnly` configuration, as shown in the following example:

0 commit comments

Comments
 (0)