Skip to content
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

ResolveMainClassName calls getProject() at execution time, making it incompatible with Gradle's configuration cache #39644

Closed
wants to merge 1 commit into from

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Feb 21, 2024

A task must not use any Project objects at execution time. This includes calling Task.getProject() while the task is running.

See https://docs.gradle.org/7.0/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution

Fix GH-39635

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 21, 2024
@wilkinsona
Copy link
Member

Thanks, @quaff. Can you please revert the changes within buildSrc? They're unrelated to #39635 as they'll only affect Boot's own build. Fixing that is a much bigger piece of work being tracked by #32980.

A task must not use any Project objects at execution time. This includes calling Task.getProject() while the task is running.

See https://docs.gradle.org/7.0/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution

Fix spring-projectsGH-39635
@quaff
Copy link
Contributor Author

quaff commented Feb 22, 2024

Thanks, @quaff. Can you please revert the changes within buildSrc? They're unrelated to #39635 as they'll only affect Boot's own build. Fixing that is a much bigger piece of work being tracked by #32980.

Done.

@wilkinsona wilkinsona changed the title Avoid calling Task.getProject() at execution time ResolveMainClassName calls getProject() are execution time, making it incompatible with Gradle's configuration cache Feb 22, 2024
@wilkinsona wilkinsona added this to the 3.1.x milestone Feb 22, 2024
@wilkinsona wilkinsona added type: bug A general bug for: merge-with-amendments Needs some changes when we merge and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 22, 2024
@wilkinsona
Copy link
Member

For merge with amendments as I'd like to see if we can test this.

@wilkinsona
Copy link
Member

We already appear to have tests for this as both BootRunIntegrationTests and BootJarIntegrationTests run with the configuration cache enabled and have tests that rely on resolution of the main class name. I've also tried and failed to reproduce the problem described in #39635 using a basic project generated from start.spring.io. As such, I don't think we can merge this as we don't know if the change is necessary and, more importantly, we don't know if it'll fix the reported problem. I'll leave it on hold for now until we make some progress on understanding the underlying problem.

@wilkinsona wilkinsona removed type: bug A general bug for: merge-with-amendments Needs some changes when we merge labels Feb 27, 2024
@wilkinsona wilkinsona removed this from the 3.1.x milestone Feb 27, 2024
@wilkinsona wilkinsona added status: on-hold We can't start working on this issue yet status: waiting-for-triage An issue we've not yet triaged labels Feb 27, 2024
@wilkinsona wilkinsona changed the title ResolveMainClassName calls getProject() are execution time, making it incompatible with Gradle's configuration cache ResolveMainClassName calls getProject() at execution time, making it incompatible with Gradle's configuration cache Apr 22, 2024
@wilkinsona
Copy link
Member

Thanks again for the PR, @quaff, but I've decided to take a different approach here. Please see #40463.

@wilkinsona wilkinsona closed this Apr 22, 2024
@wilkinsona wilkinsona added status: superseded An issue that has been superseded by another and removed status: on-hold We can't start working on this issue yet status: waiting-for-triage An issue we've not yet triaged labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spring boot plugin issue using gradle cache
3 participants