gnodet opened a new issue, #13519:
URL: https://github.com/apache/maven/issues/13519

   **Parent:** #13499 | **Related:** PR #13094
   
   ## Problem
   
   Maven's internal caches (`PluginRealmCache`, `ExtensionRealmCache`, 
`ProjectRealmCache`,
   `PluginArtifactsCache`, `MavenMetadataCache`) are `@Singleton` with no 
invalidation
   mechanism. This is fine for single-shot CLI builds, but in IDE embedders the 
workspace
   is mutable — sources change, dependencies get rebuilt, and cached 
realms/artifacts
   become stale.
   
   ## Who needs this
   
   - **m2e**: Overrides **5 Maven cache components** solely to add 
eviction/flushing.
     Each override extends the default implementation and adds project-scoped 
cache
     flushing via `ProjectCachePlunger`. This is the single category 
responsible for the
     most component overrides in m2e.
   
   ## What's needed
   
   Generalize PR #13094's `PluginRealmCache.invalidate(Artifact)` pattern 
across all
   Maven caches. Options:
   
   1. Add `invalidate()` / `flush()` methods to each cache interface (like PR 
#13094 did
      for `PluginRealmCache`)
   2. Provide a unified `CacheManager` service with a single eviction API
   3. Make caches session-scoped rather than singleton (each project refresh 
gets a fresh
      session with clean caches)
   
   Any of these would eliminate 5 of m2e's 8 internal component overrides.
   
   ## Note on PR #13094
   
   PR #13094 currently addresses both workspace reader SPI and plugin realm 
cache
   invalidation. The cache invalidation part could be generalized as a 
follow-up tracked
   by this issue, while the workspace reader SPI is tracked by #13515.
   
   <!-- AI-Agent-Disclosure -->
   > 🤖 Drafted with Claude Code (Claude Opus 4.6, interactive mode). Reviewed 
and confirmed by @gnodet before submission.


-- 
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]

Reply via email to