Fix jarFileTest cache relocatability#11574
Open
ribafish wants to merge 1 commit intotestcontainers:mainfrom
Open
Fix jarFileTest cache relocatability#11574ribafish wants to merge 1 commit intotestcontainers:mainfrom
ribafish wants to merge 1 commit intotestcontainers:mainfrom
Conversation
The jarFileTest task sets `systemProperty("jarFile", absolutePath)` which
embeds an absolute path as a task input, making the task not
cache-relocatable across different project locations.
Fix by:
- Using `inputs.files(shadowJar).withPathSensitivity(RELATIVE)` instead
of the bare `file()` call (which doesn't register a proper input)
- Passing the jar path as a relative path to the system property
The test (AbstractJarFileTest) uses `Paths.get(System.getProperty("jarFile"))`
which resolves relative paths against the working directory (project dir),
so the test works identically with both absolute and relative paths.
ribafish
added a commit
to gradle/develocity-oss-projects
that referenced
this pull request
Mar 19, 2026
Point workflow at ribafish/testcontainers-java fork with the fix branch to validate the upstream PR (testcontainers/testcontainers-java#11574). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ribafish
added a commit
to gradle/develocity-oss-projects
that referenced
this pull request
Mar 19, 2026
Bump JDK 11→17, exclude failing VolumeRemoval tests, and mark jarFileTest as non-cacheable (absolute path in systemProperty). Upstream fix: testcontainers/testcontainers-java#11574
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.
Problem
The
jarFileTesttask setssystemProperty("jarFile", shadowJar.outputs.files.singleFile)which embeds an absolute path as a task input. This makes the task not cache-relocatable — when run from a different project location, the cache key changes even though the actual jar content is identical.Additionally, the
file(shadowJar.outputs.files.singleFile)call doesn't actually register a proper task input with Gradle's input tracking.This is an example cache miss because of this issue.
Fix
file(...)withinputs.files(shadowJar).withPathSensitivity(PathSensitivity.RELATIVE)— properly registers the shadow jar as an input with relative path normalizationproject.projectDir.relativize(jarFile)) to the system property — producesbuild/libs/testcontainers-<version>-all.jarinstead of/home/user/project/core/build/libs/...AbstractJarFileTestusesPaths.get(System.getProperty("jarFile"))which resolves relative paths against the working directory (project dir by default), so the test works identically.Here is a run against this branch, verifying the fix and the overall build.