You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Gradle dependency cache key should include gradle.properties #1222
Description:
The default Gradle dependency-cache key does not include **/gradle.properties. Gradle projects commonly declare dependency versions, plugin versions, or repository-related properties there and interpolate them from build.gradle or build.gradle.kts.
When only gradle.properties changes, setup-java computes the same primary key. If that key is an exact cache hit, the post action intentionally skips saving. Dependencies downloaded after the property change therefore cannot enter a new cache entry and may be downloaded again on every subsequent run.
cache-dependency-path can include gradle.properties as a workaround, but that requires each affected project to replace otherwise sensible defaults. The default Gradle patterns should include **/gradle.properties.
This was previously attempted in #460. That PR became stale and conflicted; when closing it, maintainers said a fresh focused PR was welcome.
Task version: actions/setup-java@v5 and current main
Platform:
Ubuntu
macOS
Windows
Runner type:
Hosted
Self-hosted
Repro steps:
Create a Gradle project with a dependency version in gradle.properties, for example junitVersion=5.12.0.
Reference it from build.gradle, for example testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}".
Run a workflow using actions/setup-java@v5 with cache: gradle, then run it again so the primary cache key is an exact hit.
Change only gradle.properties, for example to junitVersion=5.13.0, and rerun the workflow.
Observe that the primary cache key is unchanged. Gradle downloads the new dependency, but setup-java skips saving because the unchanged primary key was an exact hit.
Rerun without further changes and observe that the new dependency may need to be downloaded again.
Expected behavior:
Changing gradle.properties changes the default Gradle dependency-cache key, allowing dependencies resolved from the updated properties to be saved in a new cache entry.
Actual behavior:
Changing only gradle.properties leaves the default Gradle dependency-cache key unchanged. An exact hit prevents saving the updated dependency cache under a new key.
Activity