Maven repository update policy for cached SNAPSHOT artifacts
0 reputation · 17 Mar 2024, 20:22 UTC
Maven repository update policy for cached SNAPSHOT artifacts
Maven reuses cached SNAPSHOT artifacts from the local repository according to the update policy configured for each remote repository. Under the default daily policy, a build agent may resolve a stale SNAPSHOT for up to 24 hours after a newer version is published. The -U option forces a remote metadata check for one build only and does not alter the persistent repository configuration.
The objective is to ensure a shared build agent always resolves the latest published SNAPSHOT from its configured remote repository without requiring manual -U invocation. The open constraint is whether a persistent repository-level update policy can override the daily staleness window for all SNAPSHOT artifacts, and how repository mirrors or authentication settings influence which remote source is treated as authoritative.
Can settings.xml enforce an always update policy for SNAPSHOT artifacts on a per-repository basis? Does this behavior remain consistent when a mirror redirects the repository URL? Are there meaningful differences across supported Maven 3.x releases?