[MNG-7027] Invalidate project cache upon changes
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Guillaume Nodet](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=gnt)** opened **[MNG-7027](https://issues.apache.org/jira/browse/MNG-7027?redirect=false)** and commented
To keep some kind of long-living cache (mvnd does this and I suppose m2e is doing it too), the project cache needs to be invalidated (or disabled in the case of m2e).
It would be nice if the cached entries could be invalidated upon changes. This could be done only for snapshots maybe (as non snapshots are kind supposed to be immutable and that would save quite some processing).
In order to be non disruptive, I propose the introduction of a new component that would monitor files and that could be used by the `ProjectBuilder` to manage the `ModelCache` and also the `MavenPluginManager` to manage the `PluginRealmCache`.
For the background: `mvnd` needs to redefine the `ProjectBuilder` and the `PluginRealmCache` component to work around those problems, but the `DefaultProjectBuilder` in particular is not really extensible and the `org.apache.maven.project` package has a lot of package private classes that makes defining a replacement class outside of the package quite impossible. This intermediate component would offer a pluggable way to solve both `ProjectBuilder` and `MavenPluginManager` problems.
---
**Issue Links:**
- [MNG-6530](https://issues.apache.org/jira/browse/MNG-6530) Regression in ProjectBuilder when file change between invocations (introduced by MNG-6311)
- [MNG-6311](https://issues.apache.org/jira/browse/MNG-6311) Maven intolerably slow when import scope used heavily in large project
- [MNG-6616](https://issues.apache.org/jira/browse/MNG-6616) Create public API for Projects Artifacts Cache where one project can be invalidated
Contributor guide
Assessment
This issue has not been assessed yet.