When BootJar is building a layered jar, it currently resolves all of the project's Configurations so that it can map the files on the classpath to their dependency coordinates. This resolution is unnecessarily broad as the files on the classpath can only come from configurations that have already been resolved.

Comment From: elvay1

It looks like this modification prevent classes compiled by other sourcesets and included in runtimeClasspath of the main sourceSet to be included in the bootJar archive. Thus it makes the plugins documentation inaccurate :

Creates a [BootJar](https://docs.spring.io/spring-boot/docs/2.6.3/gradle-plugin/api/org/springframework/boot/gradle/tasks/bundling/BootJar.html) task named bootJar that will create an executable, fat jar for the project. The jar will contain everything on the runtime classpath of the main source set; classes are packaged in BOOT-INF/classes and jars are packaged in BOOT-INF/lib

Comment From: wilkinsona

@elvay1 The changes made in https://github.com/spring-projects/spring-boot/commit/f5df6e463a7e66de3a5c82c68d915dadebf3b7b0 should only affect layering and the ability to allocate dependencies to particular layers. If the changes are having an effect that is broader than that then you may have found a bug. To help us to investigate, please open a new issue and provided a complete yet minimal sample that reproduces the behaviour you have described.