Fix build cache hits for FindMainClassTask and GroovyPageForkCompileTask#15537
Merged
matrei merged 2 commits intoapache:7.0.xfrom Mar 31, 2026
Merged
Fix build cache hits for FindMainClassTask and GroovyPageForkCompileTask#15537matrei merged 2 commits intoapache:7.0.xfrom
matrei merged 2 commits intoapache:7.0.xfrom
Conversation
The upToDateWhen closure checked whether the cache file existed, returning false when missing. Per Gradle docs, upToDateWhen returning false prevents both up-to-date checks and build cache loading, making the @CacheableTask annotation ineffective. This check is redundant — Gradle already tracks the @OutputFile and knows to re-execute when it is missing. The manual cache file deletion in the task action is also redundant since Gradle automatically cleans task outputs before re-execution.
compileGroovyPages and compileWebappGroovyPages both wrote to
build/gsp-classes/main, causing Gradle to detect overlapping outputs
and disable caching for both tasks.
Give compileWebappGroovyPages a separate output directory
(build/gsp-classes/webapp) and update War/Jar packaging to include
both directories. The runtime classpath is unaffected because
output.dir('gsp-classes') already registers the parent directory.
✅ All tests passed ✅🏷️ Commit: ab6511c Learn more about TestLens at testlens.app. |
davydotcom
approved these changes
Mar 30, 2026
matrei
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FindMainClassTask: remove upToDateWhen preventing cache hits
outputs.upToDateWhenclosure that checked if the cache file exists — per Gradle docs, returning false prevents both up-to-date checks and build cache loading, making@CacheableTaskineffectiveBoth checks are redundant since Gradle already tracks the
@OutputFileannotation and knows to re-execute when the output is missing.GroovyPageForkCompileTask: fix overlapping outputs
compileGroovyPagesandcompileWebappGroovyPagesboth wrote tobuild/gsp-classes/main, causing Gradle to detect overlapping outputs and disable caching for both taskscompileWebappGroovyPagesits own output directory (build/gsp-classes/webapp) and update War/Jar packaging to include both directoriesoutput.dir('gsp-classes')already registers the parent directory