Java Code Examples for org.eclipse.aether.impl.DefaultServiceLocator#setErrorHandler()
The following examples show how to use
org.eclipse.aether.impl.DefaultServiceLocator#setErrorHandler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AetherUtil.java From buck with Apache License 2.0 | 6 votes |
public static ServiceLocator initServiceLocator() { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.setErrorHandler( new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { throw new RuntimeException( String.format( "Failed to initialize service %s, implemented by %s: %s", type.getName(), impl.getName(), exception.getMessage()), exception); } }); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); // Use a no-op logger. Leaving this out would introduce a runtime dependency on log4j locator.addService(ILoggerFactory.class, NOPLoggerFactory.class); // Also requires log4j // locator.addService(ILoggerFactory.class, Log4jLoggerFactory.class); return locator; }
Example 2
Source File: BootstrapMavenContext.java From quarkus with Apache License 2.0 | 6 votes |
private RepositorySystem newRepositorySystem() throws BootstrapMavenException { final DefaultServiceLocator locator = getServiceLocator(); if (!isOffline()) { locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, WagonTransporterFactory.class); locator.setServices(WagonConfigurator.class, new BootstrapWagonConfigurator()); locator.setServices(WagonProvider.class, new BootstrapWagonProvider()); } locator.setServices(ModelBuilder.class, new MavenModelBuilder(workspace, getCliOptions(), workspace == null ? Collections.emptyList() : getActiveSettingsProfiles())); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { log.error("Failed to initialize " + impl.getName() + " as a service implementing " + type.getName(), exception); } }); return locator.getService(RepositorySystem.class); }
Example 3
Source File: ManualRepositorySystemFactory.java From qpid-broker-j with Apache License 2.0 | 6 votes |
public static RepositorySystem newRepositorySystem() { /* * Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the * prepopulated DefaultServiceLocator, we only need to register the repository connector and transporter * factories. */ DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { exception.printStackTrace(); } }); return locator.getService(RepositorySystem.class); }
Example 4
Source File: MavenArtifactResolver.java From spring-cloud-deployer with Apache License 2.0 | 6 votes |
private RepositorySystem newRepositorySystem() { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); if (properties.isUseWagon()) { locator.addService(WagonProvider.class, StaticWagonProvider.class); locator.addService(WagonConfigurator.class, StaticWagonConfigurator.class); locator.addService(TransporterFactory.class, WagonTransporterFactory.class); } else { locator.addService(TransporterFactory.class, HttpTransporterFactory.class); } locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { throw new RuntimeException(exception); } }); return locator.getService(RepositorySystem.class); }
Example 5
Source File: Helper.java From packagedrone with Eclipse Public License 1.0 | 6 votes |
public static RepositorySystem newRepositorySystem () { final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator (); locator.addService ( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class ); locator.addService ( TransporterFactory.class, FileTransporterFactory.class ); locator.addService ( TransporterFactory.class, HttpTransporterFactory.class ); locator.setErrorHandler ( new ErrorHandler () { @Override public void serviceCreationFailed ( final Class<?> type, final Class<?> impl, final Throwable exception ) { final Logger logger = LoggerFactory.getLogger ( impl ); logger.warn ( "Service creation failed: " + type.getName (), exception ); } } ); return locator.getService ( RepositorySystem.class ); }
Example 6
Source File: MavenUtil.java From packagedrone with Eclipse Public License 1.0 | 6 votes |
public static RepositorySystem newRepositorySystem () { final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator (); locator.addService ( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class ); locator.addService ( TransporterFactory.class, FileTransporterFactory.class ); locator.addService ( TransporterFactory.class, HttpTransporterFactory.class ); locator.setErrorHandler ( new DefaultServiceLocator.ErrorHandler () { @Override public void serviceCreationFailed ( final Class<?> type, final Class<?> impl, final Throwable exception ) { exception.printStackTrace (); } } ); return locator.getService ( RepositorySystem.class ); }
Example 7
Source File: AetherUtil.java From vertx-deploy-tools with Apache License 2.0 | 6 votes |
public static RepositorySystem newRepositorySystem() { /* * Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the * prepopulated DefaultServiceLocator, we only need to register the repository connector and transporter * factories. */ DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { LOG.error(exception.getMessage(), exception); } }); return locator.getService(RepositorySystem.class); }
Example 8
Source File: MavenPluginRepository.java From BIMserver with GNU Affero General Public License v3.0 | 6 votes |
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); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { exception.printStackTrace(); } }); return locator.getService(RepositorySystem.class); }
Example 9
Source File: RemotePluginRepository.java From BIMserver with GNU Affero General Public License v3.0 | 6 votes |
public static RepositorySystem newRepositorySystem() { /* * Aether's components implement org.eclipse.aether.spi.locator.Service * to ease manual wiring and using the prepopulated * DefaultServiceLocator, we only need to register the repository * connector and transporter factories. */ DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { exception.printStackTrace(); } }); return locator.getService(RepositorySystem.class); }
Example 10
Source File: MavenUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
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); }
Example 11
Source File: DependencyResolver.java From pinpoint with Apache License 2.0 | 6 votes |
static RepositorySystem newRepositorySystem(boolean supportRemote) { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); if (supportRemote) { locator.addService(TransporterFactory.class, org.eclipse.aether.transport.http.HttpTransporterFactory.class); } locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { exception.printStackTrace(); } }); return locator.getService(RepositorySystem.class); }
Example 12
Source File: AetherUtils.java From Orienteer with Apache License 2.0 | 6 votes |
private RepositorySystem getRepositorySystem() { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { LOG.error("ServiceLocator failed", exception); } }); return locator.getService(RepositorySystem.class); }
Example 13
Source File: ArtifactResolverTest.java From revapi with Apache License 2.0 | 5 votes |
public static RepositorySystem newRepositorySystem() { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { exception.printStackTrace(); } }); return locator.getService(RepositorySystem.class); }
Example 14
Source File: ArtifactTransporter.java From jenkins-build-monitor-plugin with MIT License | 5 votes |
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); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { throw new RuntimeException("Service creation failed", exception); } }); return locator.getService(RepositorySystem.class); }
Example 15
Source File: MavenUtilTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testRepositorySystemDirect() { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.setErrorHandler(new MavenUtil.MyErrorHandler()); RepositorySystem repoSys = locator.getService(RepositorySystem.class); Assert.assertNotNull(repoSys); }
Example 16
Source File: MavenArtifactResolver.java From javafx-maven-plugin with Apache License 2.0 | 5 votes |
private RepositorySystem createRepositorySystem() { DefaultServiceLocator serviceLocator = MavenRepositorySystemUtils.newServiceLocator(); serviceLocator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); serviceLocator.addService(TransporterFactory.class, FileTransporterFactory.class); serviceLocator.addService(TransporterFactory.class, HttpTransporterFactory.class); serviceLocator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { throw new RuntimeException(exception); } }); return serviceLocator.getService(RepositorySystem.class); }
Example 17
Source File: ResolverImpl.java From vertx-stack with Apache License 2.0 | 5 votes |
private static DefaultServiceLocator getDefaultServiceLocator() { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { LOGGER.error("Service creation failure: " + exception.getMessage(), exception); } }); return locator; }
Example 18
Source File: Maven.java From bazel-deps with MIT License | 5 votes |
private static RepositorySystem newRepositorySystem() { DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); locator.addService(TransporterFactory.class, FileTransporterFactory.class); locator.addService(TransporterFactory.class, HttpTransporterFactory.class); locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { exception.printStackTrace(); } }); return locator.getService(RepositorySystem.class); }
Example 19
Source File: MavenArtifactResolver.java From client-maven-plugin with BSD 3-Clause "New" or "Revised" License | 5 votes |
private RepositorySystem createRepositorySystem() { DefaultServiceLocator serviceLocator = MavenRepositorySystemUtils.newServiceLocator(); serviceLocator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); serviceLocator.addService(TransporterFactory.class, FileTransporterFactory.class); serviceLocator.addService(TransporterFactory.class, HttpTransporterFactory.class); serviceLocator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { @Override public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) { throw new RuntimeException(exception); } }); return serviceLocator.getService(RepositorySystem.class); }