private static RepositorySystem newRepositorySystem() {
/*
* We're using DefaultServiceLocator rather than Guice/Sisu because it's more lightweight.
* This method pulls together the necessary Aether components and plugins.
*/
final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable ex) {
throw new RuntimeException("Service creation failed for type " + type.getName() + " with impl " + impl, ex);
}
});
locator.addService(org.eclipse.aether.spi.connector.RepositoryConnectorFactory.class, org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory.class);
locator.addService(org.eclipse.aether.spi.connector.transport.TransporterFactory.class, org.eclipse.aether.transport.http.HttpTransporterFactory.class);
// locator.addService(org.eclipse.aether.spi.connector.transport.TransporterFactory.class, org.eclipse.aether.transport.file.FileTransporterFactory.class);
// Takari (support concurrent downloads)
locator.setService(org.eclipse.aether.impl.SyncContextFactory.class, LockingSyncContextFactory.class);
locator.setService(org.eclipse.aether.spi.io.FileProcessor.class, LockingFileProcessor.class);
return locator.getService(RepositorySystem.class);
}