cowwoc commented on PR #394: URL: https://github.com/apache/maven-build-cache-extension/pull/394#issuecomment-3471263523
I fixed the build failures. At the same time, I introduced a change that requires your review. To protect against caching stale artifacts caused by: 1. Future timestamps (due to clock skew or malicious parties) 2. Orphaned class files (from deleted source files) 3. Stale JARs/WARs (from previous builds) I implemented a "staging directory" approach. The performance impact should be minimal as the staging operation only occurs for uncached builds and uses fast filesystem moves rather than copies. Cached builds are unaffected. ## How it works **Before the build**: Pre-existing artifacts are moved to `target/maven-build-cache-extension/` in the multimodule root, preserving their full path structure (e.g., `module1/target/classes`). This ensures Maven sees a clean target directory and must rebuild everything. After `save()`: Files are restored from staging if they weren't rebuilt (indicating they're still valid), or discarded if fresh versions exist. This approach is more robust than timestamp comparison, as it physically separates potentially stale artifacts rather than relying on heuristics. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
