Skip to content

Avoid resolving configurations unnecessarily when building a layered jar #23528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wilkinsona opened this issue Sep 29, 2020 · 2 comments
Closed
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

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.

@wilkinsona wilkinsona added the type: enhancement A general enhancement label Sep 29, 2020
@wilkinsona wilkinsona added this to the 2.4.0-M4 milestone Sep 29, 2020
@wilkinsona wilkinsona self-assigned this Sep 29, 2020
@elvay1
Copy link

elvay1 commented Feb 7, 2022

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

@wilkinsona
Copy link
Member Author

@elvay1 The changes made in f5df6e4 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants