Use the new resolver provider (#1483)

This commit is contained in:
Guillaume Nodet 2024-04-25 16:13:36 +02:00 committed by GitHub
parent 8d6bf5f033
commit 6fddd97513
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 176 additions and 151 deletions

View File

@ -19,9 +19,12 @@
package org.apache.maven.internal.impl.resolver;
import org.apache.maven.api.di.Named;
import org.apache.maven.api.di.Provides;
import org.apache.maven.api.di.Singleton;
import org.eclipse.aether.util.version.GenericVersionScheme;
import org.eclipse.aether.version.InvalidVersionSpecificationException;
import org.eclipse.aether.version.Version;
import org.eclipse.aether.version.VersionConstraint;
import org.eclipse.aether.version.VersionRange;
import org.eclipse.aether.version.VersionScheme;
/**
@ -29,10 +32,22 @@ import org.eclipse.aether.version.VersionScheme;
*/
@Singleton
@Named
public final class DefaultVersionSchemeProvider {
public class MavenVersionScheme implements VersionScheme {
@Provides
static VersionScheme getVersionScheme() {
return new GenericVersionScheme();
private final VersionScheme delegate = new GenericVersionScheme();
@Override
public Version parseVersion(String version) throws InvalidVersionSpecificationException {
return delegate.parseVersion(version);
}
@Override
public VersionRange parseVersionRange(String range) throws InvalidVersionSpecificationException {
return delegate.parseVersionRange(range);
}
@Override
public VersionConstraint parseVersionConstraint(String constraint) throws InvalidVersionSpecificationException {
return delegate.parseVersionConstraint(constraint);
}
}

View File

@ -61,7 +61,7 @@ import org.apache.maven.internal.impl.*;
import org.apache.maven.internal.impl.model.*;
import org.apache.maven.internal.impl.resolver.DefaultVersionRangeResolver;
import org.apache.maven.internal.impl.resolver.DefaultVersionResolver;
import org.apache.maven.internal.impl.resolver.DefaultVersionSchemeProvider;
import org.apache.maven.internal.impl.resolver.MavenVersionScheme;
import org.apache.maven.internal.impl.resolver.type.DefaultTypeProvider;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
@ -104,7 +104,7 @@ public class ApiRunner {
injector.bindImplicit(ExtensibleEnumRegistries.class);
injector.bindImplicit(DefaultTypeProvider.class);
injector.bindImplicit(DefaultVersionSchemeProvider.class);
injector.bindImplicit(MavenVersionScheme.class);
injector.bindImplicit(BuildModelTransformer.class);
injector.bindImplicit(DefaultDependencyManagementImporter.class);
injector.bindImplicit(DefaultDependencyManagementInjector.class);

View File

@ -30,7 +30,6 @@ import org.apache.maven.api.services.model.ModelProcessor;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.bridge.MavenRepositorySystem;
import org.apache.maven.model.root.RootLocator;
import org.apache.maven.repository.internal.ModelCacheFactory;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.impl.RemoteRepositoryManager;
@ -47,7 +46,6 @@ public class TestProjectBuilder extends DefaultProjectBuilder {
RepositorySystem repoSystem,
RemoteRepositoryManager repositoryManager,
ProjectDependenciesResolver dependencyResolver,
ModelCacheFactory modelCacheFactory,
RootLocator rootLocator) {
super(
modelBuilder,
@ -57,7 +55,6 @@ public class TestProjectBuilder extends DefaultProjectBuilder {
repoSystem,
repositoryManager,
dependencyResolver,
modelCacheFactory,
rootLocator);
}

View File

@ -37,10 +37,10 @@ import org.apache.maven.api.services.TypeRegistry;
import org.apache.maven.api.xml.XmlNode;
import org.apache.maven.eventspy.internal.EventSpyDispatcher;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.internal.impl.resolver.MavenSessionBuilderSupplier;
import org.apache.maven.internal.xml.XmlNodeImpl;
import org.apache.maven.internal.xml.XmlPlexusConfiguration;
import org.apache.maven.model.ModelBase;
import org.apache.maven.repository.internal.MavenSessionBuilderSupplier;
import org.apache.maven.resolver.RepositorySystemSessionFactory;
import org.apache.maven.rtinfo.RuntimeInformation;
import org.apache.maven.settings.Mirror;

View File

@ -38,7 +38,7 @@ import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.manager.LegacyArtifactHandlerManager;
import org.apache.maven.eventspy.AbstractEventSpy;
import org.apache.maven.execution.ExecutionEvent;
import org.apache.maven.repository.internal.type.DefaultType;
import org.apache.maven.internal.impl.resolver.type.DefaultType;
import static java.util.function.Function.identity;
import static org.apache.maven.internal.impl.Utils.nonNull;

View File

@ -21,9 +21,13 @@ package org.apache.maven.internal.impl;
import javax.inject.Named;
import javax.inject.Provider;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
@ -33,51 +37,17 @@ import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.google.inject.AbstractModule;
import com.google.inject.binder.AnnotatedBindingBuilder;
import com.google.inject.name.Names;
import org.apache.maven.api.services.MavenException;
import org.apache.maven.api.services.model.ProfileActivator;
import org.apache.maven.api.spi.LanguageProvider;
import org.apache.maven.api.spi.LifecycleProvider;
import org.apache.maven.api.spi.ModelParser;
import org.apache.maven.api.spi.PackagingProvider;
import org.apache.maven.di.Injector;
import org.apache.maven.di.Key;
import org.apache.maven.di.impl.Binding;
import org.apache.maven.di.impl.DIException;
import org.apache.maven.di.impl.InjectorImpl;
import org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory;
import org.apache.maven.internal.aether.LegacyRepositorySystemSessionExtender;
import org.apache.maven.internal.impl.model.BuildModelTransformer;
import org.apache.maven.internal.impl.model.DefaultDependencyManagementImporter;
import org.apache.maven.internal.impl.model.DefaultDependencyManagementInjector;
import org.apache.maven.internal.impl.model.DefaultInheritanceAssembler;
import org.apache.maven.internal.impl.model.DefaultLifecycleBindingsInjector;
import org.apache.maven.internal.impl.model.DefaultModelBuilder;
import org.apache.maven.internal.impl.model.DefaultModelInterpolator;
import org.apache.maven.internal.impl.model.DefaultModelNormalizer;
import org.apache.maven.internal.impl.model.DefaultModelPathTranslator;
import org.apache.maven.internal.impl.model.DefaultModelProcessor;
import org.apache.maven.internal.impl.model.DefaultModelValidator;
import org.apache.maven.internal.impl.model.DefaultModelVersionProcessor;
import org.apache.maven.internal.impl.model.DefaultPathTranslator;
import org.apache.maven.internal.impl.model.DefaultPluginManagementInjector;
import org.apache.maven.internal.impl.model.DefaultProfileInjector;
import org.apache.maven.internal.impl.model.DefaultProfileSelector;
import org.apache.maven.internal.impl.model.DefaultRootLocator;
import org.apache.maven.internal.impl.model.ProfileActivationFilePathInterpolator;
import org.apache.maven.internal.impl.model.profile.FileProfileActivator;
import org.apache.maven.internal.impl.model.profile.JdkVersionProfileActivator;
import org.apache.maven.internal.impl.model.profile.OperatingSystemProfileActivator;
import org.apache.maven.internal.impl.model.profile.PackagingProfileActivator;
import org.apache.maven.internal.impl.model.profile.PropertyProfileActivator;
import org.apache.maven.internal.impl.resolver.DefaultArtifactDescriptorReader;
import org.apache.maven.internal.impl.resolver.DefaultVersionSchemeProvider;
import org.apache.maven.internal.impl.resolver.relocation.DistributionManagementArtifactRelocationSource;
import org.apache.maven.internal.impl.resolver.relocation.UserPropertiesArtifactRelocationSource;
import org.codehaus.plexus.PlexusContainer;
import org.eclipse.aether.version.VersionScheme;
@Named
class SisuDiBridgeModule extends AbstractModule {
@ -86,7 +56,7 @@ class SisuDiBridgeModule extends AbstractModule {
protected void configure() {
Provider<PlexusContainer> containerProvider = getProvider(PlexusContainer.class);
Injector injector = new InjectorImpl() {
InjectorImpl injector = new InjectorImpl() {
@Override
public <Q> Supplier<Q> getCompiledBinding(Key<Q> key) {
Set<Binding<Q>> res = getBindings(key);
@ -163,102 +133,45 @@ class SisuDiBridgeModule extends AbstractModule {
.asIterator();
it.hasNext(); ) {
URL url = it.next();
try (InputStream is = url.openStream()) {
String[] lines = new String(is.readAllBytes()).split("\n");
List<String> lines;
try (InputStream is = url.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
lines = reader.lines()
.map(String::trim)
.filter(s -> !s.isEmpty() && !s.startsWith("#"))
.toList();
}
for (String className : lines) {
try {
Class<?> clazz = classLoader.loadClass(className);
injector.bindImplicit(clazz);
Class<Object> itf = (Class)
(clazz.isInterface()
? clazz
: clazz.getInterfaces().length > 0 ? clazz.getInterfaces()[0] : null);
if (itf != null) {
bind(itf).toProvider(() -> injector.getInstance(clazz));
}
} catch (ClassNotFoundException e) {
// ignore
e.printStackTrace();
}
}
}
}
} catch (IOException e) {
throw new MavenException(e);
}
Stream.of(
LanguageProvider.class,
LifecycleProvider.class,
PackagingProvider.class,
DefaultArtifactCoordinateFactory.class,
DefaultArtifactDeployer.class,
DefaultArtifactFactory.class,
DefaultArtifactInstaller.class,
DefaultArtifactResolver.class,
DefaultChecksumAlgorithmService.class,
DefaultDependencyCollector.class,
DefaultDependencyCoordinateFactory.class,
DefaultLocalRepositoryManager.class,
DefaultMessageBuilderFactory.class,
DefaultModelXmlFactory.class,
DefaultRepositoryFactory.class,
DefaultSettingsBuilder.class,
DefaultSettingsXmlFactory.class,
DefaultToolchainsBuilder.class,
DefaultToolchainsXmlFactory.class,
DefaultTransportProvider.class,
DefaultVersionParser.class,
DefaultVersionRangeResolver.class,
DefaultVersionResolver.class,
DefaultVersionSchemeProvider.class,
VersionScheme.class,
DefaultModelVersionParser.class,
DefaultRepositorySystemSessionFactory.class,
LegacyRepositorySystemSessionExtender.class,
ExtensibleEnumRegistries.DefaultLanguageRegistry.class,
ExtensibleEnumRegistries.DefaultPathScopeRegistry.class,
ExtensibleEnumRegistries.DefaultProjectScopeRegistry.class,
DefaultModelBuilder.class,
DefaultModelProcessor.class,
ModelParser.class,
DefaultModelValidator.class,
DefaultModelVersionProcessor.class,
DefaultModelNormalizer.class,
DefaultModelInterpolator.class,
DefaultPathTranslator.class,
DefaultUrlNormalizer.class,
DefaultRootLocator.class,
DefaultModelPathTranslator.class,
DefaultModelUrlNormalizer.class,
DefaultSuperPomProvider.class,
DefaultInheritanceAssembler.class,
DefaultProfileSelector.class,
ProfileActivator.class,
DefaultProfileInjector.class,
DefaultPluginManagementInjector.class,
DefaultDependencyManagementInjector.class,
DefaultDependencyManagementImporter.class,
DefaultLifecycleBindingsInjector.class,
DefaultPluginConfigurationExpander.class,
ProfileActivationFilePathInterpolator.class,
BuildModelTransformer.class,
DefaultArtifactDescriptorReader.class,
DistributionManagementArtifactRelocationSource.class,
UserPropertiesArtifactRelocationSource.class,
FileProfileActivator.class,
JdkVersionProfileActivator.class,
OperatingSystemProfileActivator.class,
PackagingProfileActivator.class,
PropertyProfileActivator.class)
.forEach((Class<?> clazz) -> {
injector.bindImplicit(clazz);
Class<Object> itf = (Class)
(clazz.isInterface()
injector.getBindings().keySet().stream()
.filter(k -> k.getQualifier() != null)
.sorted(Comparator.comparing(k -> k.getRawType().getName()))
.distinct()
.forEach(key -> {
Class<?> clazz = key.getRawType();
Class<Object> itf = (clazz.isInterface()
? null
: clazz.getInterfaces().length > 0 ? clazz.getInterfaces()[0] : null);
: (Class<Object>) (clazz.getInterfaces().length > 0 ? clazz.getInterfaces()[0] : clazz));
if (itf != null) {
bind(itf).toProvider(() -> injector.getInstance(clazz));
AnnotatedBindingBuilder<Object> binder = bind(itf);
if (key.getQualifier() instanceof String s) {
binder.annotatedWith(Names.named(s));
} else if (key.getQualifier() instanceof Annotation a) {
binder.annotatedWith(a);
}
binder.toProvider(() -> injector.getInstance(clazz));
}
});
}

View File

@ -61,6 +61,7 @@ import org.apache.maven.api.services.model.ProfileSelector;
import org.apache.maven.internal.impl.InternalSession;
import org.apache.maven.internal.impl.model.DefaultModelBuilder;
import org.apache.maven.internal.impl.model.DefaultProfileSelector;
import org.apache.maven.internal.impl.model.ProfileActivationFilePathInterpolator;
import org.apache.maven.internal.impl.resolver.DefaultModelResolver;
import org.apache.maven.model.v4.MavenModelVersion;
import org.apache.maven.project.MavenProject;
@ -129,6 +130,9 @@ class DefaultConsumerPomBuilder implements ConsumerPomBuilder {
@Inject
private RemoteRepositoryManager remoteRepositoryManager;
@Inject
private ProfileActivationFilePathInterpolator profileActivationFilePathInterpolator;
@Override
public Model build(RepositorySystemSession session, MavenProject project, Path src) throws ModelBuilderException {
Model model = project.getModel().getDelegate();
@ -180,7 +184,7 @@ class DefaultConsumerPomBuilder implements ConsumerPomBuilder {
dependencyManagementImporter,
lifecycleBindingsInjector,
pluginConfigurationExpander,
null,
profileActivationFilePathInterpolator,
modelTransformer,
versionParser,
remoteRepositoryManager);

View File

@ -135,7 +135,7 @@ public class DefaultMavenPluginManager implements MavenPluginManager {
private final ClassRealmManager classRealmManager;
private final PluginDescriptorCache pluginDescriptorCache;
private final PluginRealmCache pluginRealmCache;
private final DefaultPluginDependenciesResolver pluginDependenciesResolver;
private final PluginDependenciesResolver pluginDependenciesResolver;
private final ExtensionRealmCache extensionRealmCache;
private final PluginVersionResolver pluginVersionResolver;
private final PluginArtifactsCache pluginArtifactsCache;
@ -153,7 +153,7 @@ public class DefaultMavenPluginManager implements MavenPluginManager {
ClassRealmManager classRealmManager,
PluginDescriptorCache pluginDescriptorCache,
PluginRealmCache pluginRealmCache,
DefaultPluginDependenciesResolver pluginDependenciesResolver,
PluginDependenciesResolver pluginDependenciesResolver,
ExtensionRealmCache extensionRealmCache,
PluginVersionResolver pluginVersionResolver,
PluginArtifactsCache pluginArtifactsCache,

View File

@ -27,6 +27,7 @@ import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.resolution.DependencyResult;
/**
* Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility interface
@ -68,4 +69,12 @@ public interface PluginDependenciesResolver {
List<RemoteRepository> repositories,
RepositorySystemSession session)
throws PluginResolutionException;
DependencyResult resolvePlugin(
Plugin plugin,
Artifact artifact,
DependencyFilter dependencyFilter,
List<RemoteRepository> remotePluginRepositories,
RepositorySystemSession repositorySession)
throws PluginResolutionException;
}

View File

@ -69,7 +69,6 @@ import org.apache.maven.model.building.ModelSource3;
import org.apache.maven.model.resolution.UnresolvableModelException;
import org.apache.maven.model.root.RootLocator;
import org.apache.maven.repository.internal.ArtifactDescriptorUtils;
import org.apache.maven.repository.internal.ModelCacheFactory;
import org.apache.maven.utils.Os;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
@ -100,7 +99,6 @@ public class DefaultProjectBuilder implements ProjectBuilder {
private final org.eclipse.aether.RepositorySystem repoSystem;
private final RemoteRepositoryManager repositoryManager;
private final ProjectDependenciesResolver dependencyResolver;
private final ModelCacheFactory modelCacheFactory;
private final RootLocator rootLocator;
@ -114,7 +112,6 @@ public class DefaultProjectBuilder implements ProjectBuilder {
RepositorySystem repoSystem,
RemoteRepositoryManager repositoryManager,
ProjectDependenciesResolver dependencyResolver,
ModelCacheFactory modelCacheFactory,
RootLocator rootLocator) {
this.modelBuilder = modelBuilder;
this.modelProcessor = modelProcessor;
@ -123,7 +120,6 @@ public class DefaultProjectBuilder implements ProjectBuilder {
this.repoSystem = repoSystem;
this.repositoryManager = repositoryManager;
this.dependencyResolver = dependencyResolver;
this.modelCacheFactory = modelCacheFactory;
this.rootLocator = rootLocator;
}
// ----------------------------------------------------------------------

View File

@ -35,13 +35,13 @@ import org.apache.maven.api.model.Dependency;
import org.apache.maven.api.model.Model;
import org.apache.maven.api.model.Parent;
import org.apache.maven.api.model.Repository;
import org.apache.maven.internal.impl.resolver.ArtifactDescriptorUtils;
import org.apache.maven.model.building.ArtifactModelSource;
import org.apache.maven.model.building.FileModelSource;
import org.apache.maven.model.building.ModelSource;
import org.apache.maven.model.resolution.InvalidRepositoryException;
import org.apache.maven.model.resolution.ModelResolver;
import org.apache.maven.model.resolution.UnresolvableModelException;
import org.apache.maven.repository.internal.ArtifactDescriptorUtils;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
@ -141,8 +141,8 @@ public class ProjectModelResolver implements ModelResolver {
removeMatchingRepository(pomRepositories, repository.getId());
}
List<RemoteRepository> newRepositories = Collections.singletonList(
ArtifactDescriptorUtils.toRemoteRepository(new org.apache.maven.model.Repository(repository)));
List<RemoteRepository> newRepositories =
Collections.singletonList(ArtifactDescriptorUtils.toRemoteRepository(repository));
if (ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals(repositoryMerging)) {
repositories = remoteRepositoryManager.aggregateRepositories(session, repositories, newRepositories, true);

View File

@ -0,0 +1,69 @@
org.apache.maven.api.services.model.ProfileActivator
org.apache.maven.api.spi.LanguageProvider
org.apache.maven.api.spi.LifecycleProvider
org.apache.maven.api.spi.ModelParser
org.apache.maven.api.spi.PackagingProvider
org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory
org.apache.maven.internal.aether.LegacyRepositorySystemSessionExtender
org.apache.maven.internal.impl.DefaultArtifactCoordinateFactory
org.apache.maven.internal.impl.DefaultArtifactDeployer
org.apache.maven.internal.impl.DefaultArtifactFactory
org.apache.maven.internal.impl.DefaultArtifactInstaller
org.apache.maven.internal.impl.DefaultArtifactResolver
org.apache.maven.internal.impl.DefaultChecksumAlgorithmService
org.apache.maven.internal.impl.DefaultDependencyCollector
org.apache.maven.internal.impl.DefaultDependencyCoordinateFactory
org.apache.maven.internal.impl.DefaultLocalRepositoryManager
org.apache.maven.internal.impl.DefaultMessageBuilderFactory
org.apache.maven.internal.impl.DefaultModelXmlFactory
org.apache.maven.internal.impl.DefaultRepositoryFactory
org.apache.maven.internal.impl.DefaultSettingsBuilder
org.apache.maven.internal.impl.DefaultSettingsXmlFactory
org.apache.maven.internal.impl.DefaultToolchainsBuilder
org.apache.maven.internal.impl.DefaultToolchainsXmlFactory
org.apache.maven.internal.impl.DefaultTransportProvider
org.apache.maven.internal.impl.DefaultVersionParser
org.apache.maven.internal.impl.DefaultVersionRangeResolver
org.apache.maven.internal.impl.DefaultVersionResolver
org.apache.maven.internal.impl.DefaultModelVersionParser
org.apache.maven.internal.impl.DefaultUrlNormalizer
org.apache.maven.internal.impl.DefaultModelUrlNormalizer
org.apache.maven.internal.impl.DefaultSuperPomProvider
org.apache.maven.internal.impl.DefaultPluginConfigurationExpander
org.apache.maven.internal.impl.ExtensibleEnumRegistries$DefaultLanguageRegistry
org.apache.maven.internal.impl.ExtensibleEnumRegistries$DefaultPathScopeRegistry
org.apache.maven.internal.impl.ExtensibleEnumRegistries$DefaultProjectScopeRegistry
org.apache.maven.internal.impl.model.DefaultModelBuilder
org.apache.maven.internal.impl.model.DefaultModelProcessor
org.apache.maven.internal.impl.model.DefaultModelValidator
org.apache.maven.internal.impl.model.DefaultModelVersionProcessor
org.apache.maven.internal.impl.model.DefaultModelNormalizer
org.apache.maven.internal.impl.model.DefaultModelInterpolator
org.apache.maven.internal.impl.model.DefaultPathTranslator
org.apache.maven.internal.impl.model.DefaultRootLocator
org.apache.maven.internal.impl.model.DefaultModelPathTranslator
org.apache.maven.internal.impl.model.DefaultInheritanceAssembler
org.apache.maven.internal.impl.model.DefaultProfileSelector
org.apache.maven.internal.impl.model.DefaultProfileInjector
org.apache.maven.internal.impl.model.DefaultPluginManagementInjector
org.apache.maven.internal.impl.model.DefaultDependencyManagementInjector
org.apache.maven.internal.impl.model.DefaultDependencyManagementImporter
org.apache.maven.internal.impl.model.DefaultLifecycleBindingsInjector
org.apache.maven.internal.impl.model.ProfileActivationFilePathInterpolator
org.apache.maven.internal.impl.model.BuildModelTransformer
org.apache.maven.internal.impl.model.profile.FileProfileActivator
org.apache.maven.internal.impl.model.profile.JdkVersionProfileActivator
org.apache.maven.internal.impl.model.profile.OperatingSystemProfileActivator
org.apache.maven.internal.impl.model.profile.PackagingProfileActivator
org.apache.maven.internal.impl.model.profile.PropertyProfileActivator
org.apache.maven.internal.impl.resolver.PluginsMetadataGeneratorFactory
org.apache.maven.internal.impl.resolver.SnapshotMetadataGeneratorFactory
org.apache.maven.internal.impl.resolver.VersionsMetadataGeneratorFactory
org.apache.maven.internal.impl.resolver.DefaultVersionResolver
org.apache.maven.internal.impl.resolver.DefaultVersionRangeResolver
org.apache.maven.internal.impl.resolver.DefaultArtifactDescriptorReader
org.apache.maven.internal.impl.resolver.DefaultArtifactDescriptorReader
org.apache.maven.internal.impl.resolver.MavenVersionScheme
org.apache.maven.internal.impl.resolver.relocation.DistributionManagementArtifactRelocationSource
org.apache.maven.internal.impl.resolver.relocation.UserPropertiesArtifactRelocationSource
org.apache.maven.internal.impl.resolver.type.DefaultTypeProvider

View File

@ -49,9 +49,11 @@ import org.apache.maven.session.scope.internal.SessionScope;
import org.apache.maven.toolchain.DefaultToolchainManagerPrivate;
import org.apache.maven.toolchain.building.ToolchainsBuilder;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.testing.PlexusTest;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.impl.MetadataGeneratorFactory;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.junit.jupiter.api.BeforeEach;
@ -209,6 +211,14 @@ class TestApi {
assertEquals("plexus-1.0.11.pom", unresolved.get(0).getFileName().toString());
}
@Test
void testMetadataGeneratorFactory() throws ComponentLookupException {
List<MetadataGeneratorFactory> factories = plexusContainer.lookupList(MetadataGeneratorFactory.class);
assertNotNull(factories);
factories.forEach(f -> System.out.println(f.getClass().getName()));
assertEquals(3, factories.size());
}
@Test
void testProjectDependencies() {
Artifact pom = session.createArtifact("org.codehaus.plexus", "plexus-container-default", "1.0-alpha-32", "pom");

View File

@ -145,6 +145,10 @@ public class InjectorImpl implements Injector {
return bindings.keySet();
}
public Map<Key<?>, Set<Binding<?>>> getBindings() {
return bindings;
}
public <Q> Supplier<Q> getCompiledBinding(Key<Q> key) {
Set<Binding<Q>> res = getBindings(key);
if (res != null && !res.isEmpty()) {

View File

@ -155,10 +155,6 @@ under the License.
<build>
<plugins>
<plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>

View File

@ -0,0 +1,12 @@
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader
org.apache.maven.repository.internal.DefaultModelCacheFactory
org.apache.maven.repository.internal.DefaultModelVersionParser
org.apache.maven.repository.internal.DefaultVersionRangeResolver
org.apache.maven.repository.internal.DefaultVersionResolver
org.apache.maven.repository.internal.DefaultVersionSchemeProvider
org.apache.maven.repository.internal.PluginsMetadataGeneratorFactory
org.apache.maven.repository.internal.SnapshotMetadataGeneratorFactory
org.apache.maven.repository.internal.VersionsMetadataGeneratorFactory
org.apache.maven.repository.internal.relocation.DistributionManagementArtifactRelocationSource
org.apache.maven.repository.internal.relocation.UserPropertiesArtifactRelocationSource
org.apache.maven.repository.internal.type.DefaultTypeProvider