private RepositorySystem newRepositorySystem() { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); return locator.getService(RepositorySystem.class); }
/** * Creates a new service locator that already knows about all service implementations included in * this library. To acquire a complete repository system, clients need to add some repository * connectors for remote transfers. * * @return The new service locator, never {@code null}. */ public static DefaultServiceLocator newServiceLocator() { DefaultServiceLocator locator = new DefaultServiceLocator(); locator.addService(ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class); locator.addService(VersionResolver.class, DefaultVersionResolver.class); locator.addService(VersionRangeResolver.class, DefaultVersionRangeResolver.class); locator.addService(MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class); locator.addService(MetadataGeneratorFactory.class, VersionsMetadataGeneratorFactory.class); return locator; }
static RepositorySystem newRepositorySystem() { /* * Aether's components implement * org.sonatype.aether.spi.locator.Service to ease manual wiring and * using the prepopulated DefaultServiceLocator, we only need to * register the repository connector factories. */ DefaultServiceLocator locator = new DefaultServiceLocator(); locator.addService(ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class); locator.addService(VersionResolver.class, DefaultVersionResolver.class); locator.addService(VersionRangeResolver.class, DefaultVersionRangeResolver.class); locator.addService(MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class); locator.addService(MetadataGeneratorFactory.class, VersionsMetadataGeneratorFactory.class); locator.setErrorHandler(new MyErrorHandler()); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); // locator.addService(TransporterFactory.class, WagonTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); return locator.getService(RepositorySystem.class); }