Fix build cache relocatability for checkstyle:check#5067
Open
ribafish wants to merge 2 commits intohibernate:mainfrom
Open
Fix build cache relocatability for checkstyle:check#5067ribafish wants to merge 2 commits intohibernate:mainfrom
ribafish wants to merge 2 commits intohibernate:mainfrom
Conversation
|
Thanks for your pull request! This pull request appears to follow the contribution rules. › This message was automatically generated. |
ribafish
added a commit
to gradle/develocity-oss-projects
that referenced
this pull request
Mar 19, 2026
Point experiment at fork branch with the fix to validate before applying the workaround in the experiment workflow. Upstream PR: hibernate/hibernate-search#5067
ribafish
added a commit
to gradle/develocity-oss-projects
that referenced
this pull request
Mar 19, 2026
checkstyle:check is not cache-relocatable because project resources
include ${rootProject.directory}, fingerprinting the entire workspace
root tree including target/ dirs from previous builds (83 cache misses).
Upstream PR: hibernate/hibernate-search#5067
3 tasks
The project-level <resource> pointing at ${rootProject.directory} (to
include LICENSE.txt in META-INF) caused the entire workspace root to be
fingerprinted as a build cache input for all goals consuming project
resources. After a first build, target/ directories appear under the
root, changing the fingerprint and causing cache misses for
checkstyle:check across all 83 modules.
Replace with a dedicated maven-resources-plugin copy-resources execution
that achieves the same result (LICENSE.txt in META-INF) without polluting
the project resource directories.
581bb21 to
c79235f
Compare
The HibernateSearchProcessor generates *__.java metamodel files into target/generated-test-sources/test-annotations. Maven adds this as a test source root, and the Develocity extension fingerprints the directory contents as a cache input for checkstyle:check. This causes 4 cache misses in the metamodel integration test modules because the generated files only appear after compiler:testCompile runs. Two fixes: - Add **/*__.java to checkstyle excludes (skip style-checking generated code) - Add develocity-custom-user-data.groovy to exclude **/target/** from the checkstyle testSourceDirectories cache input fingerprint
a1e8b3e to
0a07a9c
Compare
Member
marko-bekhta
left a comment
There was a problem hiding this comment.
Hey 👋🏻 🙂
Thanks for the PR! Hm that's an interesting finding.
Comment on lines
+1
to
+9
| buildCache.registerMojoMetadataProvider(context -> { | ||
| context.withPlugin("maven-checkstyle-plugin", () -> { | ||
| context.inputs(inputs -> { | ||
| inputs.fileSet("testSourceDirectories", fileSet -> | ||
| fileSet.excludes("**/target/**") | ||
| ) | ||
| }) | ||
| }) | ||
| }) |
Member
There was a problem hiding this comment.
we have https://github.com/hibernate/hibernate-develocity-maven-extension for these. would you want to move it there ?
|
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
checkstyle:checkhas 83 cache misses across all modules because the project-level<resource>in the rootpom.xmlpoints at${rootProject.directory}(to includeLICENSE.txtinMETA-INF). This causes the Develocity Maven extension to fingerprint the entire workspace root directory tree as a build cache input for all goals consuming project resources. After a first build,target/directories appear under the root, changing the fingerprint and invalidating the cache forcheckstyle:checkin every module.Fix: replace the resource declaration with a dedicated
maven-resources-plugin:copy-resourcesexecution.Evidence:
JIRA: https://hibernate.atlassian.net/browse/HSEARCH-5595
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.