Skip to content

Commit

Permalink
Add MVND_NO_MODEL_CACHE support to mvn39
Browse files Browse the repository at this point in the history
Follow-up to #797, which didn't get backported to the mvn39 part of the code.
  • Loading branch information
oehme authored and gnodet committed Apr 6, 2023
1 parent 99a5cfb commit 6bcb580
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.sisu.Priority;

import static org.mvndaemon.mvnd.common.Environment.MVND_NO_MODEL_CACHE;

@Singleton
@Named
@Priority(10)
Expand All @@ -48,6 +50,10 @@ public SnapshotModelCacheFactory(DefaultModelCacheFactory factory) {

@Override
public ModelCache createCache(RepositorySystemSession session) {
return new SnapshotModelCache(globalCache, factory.createCache(session));
boolean noModelCache =
Boolean.parseBoolean(MVND_NO_MODEL_CACHE.asOptional().orElse(MVND_NO_MODEL_CACHE.getDefault()));
ModelCache reactorCache = factory.createCache(session);
ModelCache globalCache = noModelCache ? reactorCache : this.globalCache;
return new SnapshotModelCache(globalCache, reactorCache);
}
}

0 comments on commit 6bcb580

Please sign in to comment.