Skip to content

Commit

Permalink
Add property to disable model caching
Browse files Browse the repository at this point in the history
This is mostly for the integration tests of the Gradle Enterprise Maven extension,
which heavily test dependency resolution and reuse the same GAVs in many test,
e.g. a:b:1.0. It would be a lot of effort to rewrite all those tests and a shame
to restart the daemon every time. So I wanted to ask if you'd consider this flag
to disable the caching altogether.
  • Loading branch information
oehme committed Feb 28, 2023
1 parent 3508f0e commit 50d75b2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public SnapshotModelCacheFactory(DefaultModelCacheFactory factory) {

@Override
public ModelCache createCache(RepositorySystemSession session) {
return new SnapshotModelCache(globalCache, factory.createCache(session));
boolean enableModelCache = Boolean.parseBoolean(System.getProperty("mvnd.modelCache", "true"));
ModelCache reactorCache = factory.createCache(session);
ModelCache globalCache = enableModelCache ? this.globalCache : reactorCache;
return new SnapshotModelCache(globalCache, reactorCache);
}
}

0 comments on commit 50d75b2

Please sign in to comment.