From 2235aebf333e5db6cbcfe68cc20599453f7e06ba Mon Sep 17 00:00:00 2001 From: Gasper Kojek Date: Thu, 19 Mar 2026 10:09:47 +0100 Subject: [PATCH] Fix jarFileTest cache relocatability 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. --- core/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index 9a4d413379f..c44ea7b4761 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -34,8 +34,8 @@ task jarFileTest(type: Test) { testClassesDirs = sourceSets.jarFileTest.output.classesDirs classpath = sourceSets.jarFileTest.runtimeClasspath - file(shadowJar.outputs.files.singleFile) // input for correct caching - systemProperty("jarFile", shadowJar.outputs.files.singleFile) + inputs.files(shadowJar).withPathSensitivity(PathSensitivity.RELATIVE) + systemProperty("jarFile", project.projectDir.toPath().relativize(shadowJar.outputs.files.singleFile.toPath()).toString()) dependsOn(shadowJar) }