Fix missing @Inject, make sure the InvalidatingXxxCache are prioritized

This commit is contained in:
Peter Palaga
2021-01-25 10:37:17 +01:00
parent d3ea30f5d3
commit 26891d3144
5 changed files with 10 additions and 3 deletions

View File

@@ -27,11 +27,13 @@ import org.apache.maven.project.ExtensionDescriptor;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
import org.eclipse.sisu.Priority;
import org.mvndaemon.mvnd.cache.Cache;
import org.mvndaemon.mvnd.cache.CacheFactory;
@Singleton
@Named
@Priority(10)
public class InvalidatingExtensionRealmCache extends DefaultExtensionRealmCache {
protected static class Record implements org.mvndaemon.mvnd.cache.CacheRecord {

View File

@@ -18,16 +18,19 @@ package org.mvndaemon.mvnd.cache.invalidating;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Stream;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.DefaultPluginArtifactsCache;
import org.apache.maven.plugin.PluginResolutionException;
import org.eclipse.sisu.Priority;
import org.mvndaemon.mvnd.cache.Cache;
import org.mvndaemon.mvnd.cache.CacheFactory;
@Singleton
@Named
@Priority(10)
public class InvalidatingPluginArtifactsCache extends DefaultPluginArtifactsCache {
protected static class Record implements org.mvndaemon.mvnd.cache.CacheRecord {
@@ -50,6 +53,7 @@ public class InvalidatingPluginArtifactsCache extends DefaultPluginArtifactsCach
final Cache<Key, Record> cache;
@Inject
public InvalidatingPluginArtifactsCache(CacheFactory cacheFactory) {
this.cache = cacheFactory.newCache();
}

View File

@@ -33,12 +33,14 @@ import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.sisu.Priority;
import org.mvndaemon.mvnd.cache.Cache;
import org.mvndaemon.mvnd.cache.CacheFactory;
import org.mvndaemon.mvnd.cache.CacheRecord;
@Singleton
@Named
@Priority(10)
public class InvalidatingPluginDescriptorCache extends DefaultPluginDescriptorCache {
@FunctionalInterface

View File

@@ -24,20 +24,17 @@ import javax.inject.Singleton;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.DefaultPluginRealmCache;
import org.apache.maven.plugin.PluginContainerException;
import org.apache.maven.plugin.PluginRealmCache;
import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
import org.eclipse.sisu.Priority;
import org.eclipse.sisu.Typed;
import org.mvndaemon.mvnd.cache.Cache;
import org.mvndaemon.mvnd.cache.CacheFactory;
@Singleton
@Named
@Priority(10)
@Typed(PluginRealmCache.class)
public class InvalidatingPluginRealmCache extends DefaultPluginRealmCache {
@FunctionalInterface

View File

@@ -27,11 +27,13 @@ import org.apache.maven.artifact.Artifact;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.artifact.DefaultProjectArtifactsCache;
import org.eclipse.sisu.Priority;
import org.mvndaemon.mvnd.cache.Cache;
import org.mvndaemon.mvnd.cache.CacheFactory;
@Singleton
@Named
@Priority(10)
public class InvalidatingProjectArtifactsCache extends DefaultProjectArtifactsCache {
static class Record implements org.mvndaemon.mvnd.cache.CacheRecord {